Real Operating Systems Lecture #12
Total Page:16
File Type:pdf, Size:1020Kb
Real Operating Systems Lecture #12 Department of Computer Science and Technology University of Bedfordshire Written by David Goodwin, based on the lecture series of Dayou Li and the book Understanding Operating Systems 4thed. by I.M.Flynn and A.McIver McHoes (2006). Operating Systems, 2012 bg=white Real Operating Outline Systems Introduction Introduction DOS DOS Windows Windows Unix & Linux Unix & Linux Memory Management DOS Memory Management Windows DOS Linux Process Windows Management Linux DOS Windows Linux Process Management DOS Windows Linux bg=white Real Operating INTRODUCTION TO DIFFERENT Systems O/Ss Introduction DOS Windows Unix & Linux Memory Management DOS I Three typical operating systems Windows I Disk operating system (DOS) Linux I Windows Process Management I Unix/Linux DOS Windows Linux bg=white Real Operating DOS Systems Introduction I History DOS Windows I In 1980, IBM looked for an operating system for its Unix & Linux soon-to-be-released 6-bit personal computers Memory Management I Digital Research offered CP/M-86 DOS I Softech offered P-System Windows I MS Linux I MS also looked for OS for its 16-bit computers Process Management I Seattle Computer Products offered 86-DOS DOS I MS bought it and renamed it MS-DOS Windows Linux I IBM chose MS-DOS in 1981 and called it PC-DOS I MS-DOS evolved from v 1.0 to v 6.22 from 1981 to 1994 bg=white Real Operating DOS Systems I Features Introduction I Single user, stand-alone DOS desktop Windows I Command-line Unix & Linux I Commands are based on Memory words Management DOS I Examples Windows I COPY { copy a file Linux I DEL { delete a file Process Management I PRINT { print files on a DOS printer Windows I DIR { list files in this Linux directory I MD { make a new directory I CHKDSK { check the disk I COMP { compare two files bg=white Real Operating Layers of DOS Systems I Three layers: I Top layer { command processor Introduction DOS I Sends prompts to user Windows I Accepts commands Unix & Linux I Executes commands (including interpret commands to Memory machine language) Management I Issues responses DOS Windows Linux Process Management DOS Windows Linux bg=white Real Operating Layers of DOS Systems I I Middle layer { DOS kernel Introduction I A program containing routines that are needed for DOS interfacing disk Windows I Stored in MSDOS.SYS file Unix & Linux I Read to memory during initialisation time Memory Management DOS Windows Linux Process Management DOS Windows Linux bg=white Real Operating Layers of DOS Systems I I Bottom layer { BIOS (Basic Input/Output System) Introduction I Interfaces I/O devices such as printer, monitor and DOS keyboard Windows I Controls data flow to and from these devices Unix & Linux I Receive statues information about these devices Memory Management DOS Windows Linux Process Management DOS Windows Linux bg=white Real Operating WINDOWS Systems I History Introduction DOS I Initiative Windows I To allow users to not have to remember and use Unix & Linux system commands but via a user-friendly interface { Memory GUI Management DOS I Not a replacement of DOS Windows I Early versions (1985 to 1992) Linux I Windows 1.0 to 3.1 are only \interfaces" between GUI Process Management and DOS DOS I Single-user rather than networked Windows Linux I True O/S since 1992 I Windows 95 is first true O/S I Network O/S I Windows NT version 3.1 in 1993 led by David Cutler bg=white Real Operating WINDOWS - Design goals Systems I Extensibility { be easily enhanced to meet changes over time to support new hardware and software technologies Introduction I Privileged process and non-privileged processes DOS Windows I Kernel mode refers to the privileged mode of a Unix & Linux processor Memory I All instructions are allowed Management DOS I System memory is accessible Windows I Use mode refers to the non-privileged mode of a Linux processor Process Management I Only certain instructions are allowed DOS I System memory is not accessible Windows I O/S executes in kernel mode Linux I Application programs (protected subsystems) run in user mode I Modular structure I Drivers for new file systems, devices and networks I Objects { abstract data types bg=white Real Operating WINDOWS - Design goals Systems Introduction DOS Windows I Portability { ability for O/S to operate on different Unix & Linux machines that use different processors or configurations Memory Management I Code is modular DOS I Standard high-level programming language c/c++ is Windows used for implementation Linux I Hardware abstraction layer (HAL) providing isolation Process from hardware dependencies Management DOS I HAL abstracts hardware such as caches with a layer of Windows low-level software so that higher-level code needs no Linux change when moving from one platform to another bg=white Real Operating WINDOWS - Design goals Systems I Reliability { predictability in responding to error Introduction conditions, including hardware failures DOS Windows I Modular design Unix & Linux I NTFS to recover all types of errors Memory I US government-certifiable security Management I Virtual memory strategy to prevent one user from DOS Windows reading or modifying memory that is occupied by Linux another user Process Management I Compatibility { ability of an O/S to execute programs DOS written for other O/Ss Windows Linux I Execution environments for applications that differ from Win32 API I Source-level compatibility to POSIX (Portable Operating System Interface for Computer Environment) I Supporting already-existing file systems bg=white Real Operating WINDOWS - Design goals Systems Introduction DOS Windows I Performance { fast response times Unix & Linux I Crucial processes such as system calls and page faults Memory Management are tested and optimised DOS I LPC (local procedure call) to guarantee fast Windows communications among the protected subsystems Linux Process I Carefully designing the environment subsystems to Management ensure the speed of frequently used systems services DOS I Critical elements of Windows' networking software are Windows built in the privileged protion Linux bg=white Real Operating UNIX AND LINUX Systems Introduction DOS Windows Unix & Linux Memory Management I Advantages shared by Unix and Linux DOS I Portable Windows Linux I Powerful utilities Process I Device independent Management DOS Windows Linux bg=white Real Operating UNIX AND LINUX Systems I Evolution of UNIX Introduction DOS Windows Unix & Linux Memory Management DOS Windows Linux Process Management DOS Windows Linux bg=white Real Operating UNIX AND LINUX Systems I Evolution of LINUX Introduction DOS Windows Unix & Linux Memory Management DOS Windows Linux Process Management DOS Windows Linux bg=white Real Operating UNIX AND LINUX - Design goals Systems I Supporting software development I Keeping its algorithms as simple as possible Introduction DOS Windows Unix & Linux Memory Management DOS Windows Linux Process Management DOS Windows Linux bg=white Real Operating DOS MEMORY MANAGEMENT Systems I ROM and RAM Introduction DOS I ROM contains a section of BIOS for Windows starting up a computer Unix & Linux I RAM is mail memory where programs Memory are loaded Management DOS I Interrupt vectors Windows I BIOS interface Linux I DOS kernel Process Management I Buffer cache DOS I Installable drives Windows I Resident part of COMMAND.COM Linux I TSR I User memory I Transient part of COMMAND.COM I Reserved for BIOS bg=white Real Operating DOS MEMORY MANAGEMENT Systems I TPA allocation \policy" Introduction I Reason for allocating memory blocks in TPA for more DOS than one programs Windows I Improving efficiency when executing or accessing the Unix & Linux next program/file after executing one program Memory Management I \Policy" DOS I Dynamic allocation Windows Linux I Modification { modifying (normally giving more) memory blocks to a running program when it requires Process Management more for, e.g., I/O purposes DOS I Release of main memory{ after part of a program is Windows executed Linux I For .EXE files { allocating the max memory needed if TPA has enough free memory, otherwise, giving the min memory I For .COM files { allocating all memory it may need despite it will use or not bg=white Real Operating DOS MEMORY MANAGEMENT Systems I TPA allocation algorithms Introduction I First-fit was used in early version and Best-fit was used DOS in later version Windows I A block can be as small as 16 bytes (also known as Unix & Linux paragraph) and as large as the max available memory Memory Management (TPA) DOS I The first five bytes have special usage: Windows Linux I Byte 0 { indicator of the last block (90h if yes, 77h otherwise) Process Management I Byte 1{ indicator of status of the block (00h for busy) DOS I Byte 2 { pointer to PSP Windows I Bytes 3 and 4 { indicator of the number of paragraph Linux contained in the block I List of busy/free blocks I List is a data structure containing a head and a tail I An algorithm searches for a free block in the list for a file bg=white Real Operating WINDOWS MEMORY MANAGEMENT Systems I Memory manage challenge and solution I Challenge is to run programs written for Windows, DOS Introduction and POSIX without clashing each other in memory DOS Windows I Solution is to separate system memory and application Unix & Linux memory Memory I Example Management DOS I 4GB memory with 2GB each allocated for application Windows storage and system storage Linux Process Management DOS Windows Linux bg=white Real Operating WINDOWS MEMORY MANAGEMENT Systems I Virtual memory manager Introduction DOS I To allow applications