490 likes | 555 Views
Overview and Introduction to Computing Systems. Fred Kuhns Bryan504 fredk@cs.wustl.edu. Introduction. A computer system consists of hardware system programs application programs. What is an Operating System. It is an extended machine ( Presents a Convenient Interface to users )
E N D
Overview and Introduction to Computing Systems Fred Kuhns Bryan504 fredk@cs.wustl.edu
Introduction • A computer system consists of • hardware • system programs • application programs CS422S: Operating Systems Organization
What is an Operating System • It is an extended machine (Presents a Convenient Interface to users) • Hides the messy details which must be performed • Presents user with a virtual machine, easier to use • It is a resource manager • Each program gets time with the resource • Each program gets space on the resource CS422S: Operating Systems Organization
History of Operating Systems Early batch system • bring cards to 1401 • read cards to tape • put tape on 7094 which does computing • put tape on 1401 which prints output CS422S: Operating Systems Organization
History of Operating Systems • First generation 1945 - 1955 • vacuum tubes, plug boards • Second generation 1955 - 1965 • transistors, batch systems • Third generation 1965 – 1980 • ICs and multiprogramming • Fourth generation 1980 – present • personal computers CS422S: Operating Systems Organization
History of Operating Systems • Structure of a typical FMS job – 2nd generation CS422S: Operating Systems Organization
History of Operating Systems • Multiprogramming system • three jobs in memory – 3rd generation CS422S: Operating Systems Organization
Current “Specialized” OSes • Mainframe operating systems • Server operating systems • Multiprocessor operating systems • Personal computer operating systems • Real-time operating systems • Embedded operating systems • Smart card operating systems CS422S: Operating Systems Organization
Basic Hardware Elements • Processor - traditionally controls the operation of the computer and performs the data processing function • Memory- Stores data and programs, typically volatile (aka real or primary memory) • I/O modules - move data between computer and external environment (i.e. disks, network) • System Bus - communication among processors, memory, and I/O modules CS422S: Operating Systems Organization
Computer Hardware Review • Components of a simple personal computer Monitor Bus CS422S: Operating Systems Organization
. . . . . . . . . Computer Components: Another view CPU Memory 0 1 PC MAR Instruction MBR IR Instruction I/O AR Instruction execution unit I/O BR Data I/O Module Data Data Data . . Buffers N PC - Program Counter IR - Instruction Register MAR - Memory Address Register MBR - Memory Buffer Register I/O AR - Input/Output Address Register I/O BE - Input/Output Buffer Register CS422S: Operating Systems Organization
Control and Status Registers • Program Counter (PC) • Contains the address of an instruction to be fetched • Instruction Register (IR) • Contains the instruction most recently fetched • Program Status Word (PSW) • condition codes • Interrupt enable/disable • Supervisor/user mode CS422S: Operating Systems Organization
Fetch Cycle Execute Cycle Fetch Next Instruction Execute Instruction HALT START Instruction Cycle • Processor fetches instruction from memory • PC contains address of next instruction to be fetched • PC incremented after each fetch CS422S: Operating Systems Organization
Modern Instruction Cycle (a) A three-stage pipeline (b) A superscalar CPU CS422S: Operating Systems Organization
Typical memory hierarchy • numbers shown are rough approximations CS422S: Operating Systems Organization
Going Down the Hierarchy • Decreasing cost per bit • Increasing capacity • Increasing access time • Decreasing frequency of access of the memory by the processor • exploit locality of reference CS422S: Operating Systems Organization
Cache/Main-Memory Structure Slot Number Memory Address Tag Block 0 0 1 1 2 Block (k words) 2 3 C - 1 Block Length (k words) (b) Cache Block 2n - 1 Word Length (a) Main Memory CS422S: Operating Systems Organization
Cache Design • Write policy • keeping cache and main memory consistent • Mapping function • determines which cache location block occupies • Replacement algorithm • determines which block to replace (LRU) • Block size • data unit exchanged between cache and main memory CS422S: Operating Systems Organization
Structure of a disk drive CS422S: Operating Systems Organization
Multiprogramming and Addressing • program addresses are relative to Base Address • MMU maps virtual to physical address CS422S: Operating Systems Organization
I/O Techniques • Programmed I/O • Processor does all the work. Poll for results. • Interrupt Driven I/O • Device notifies CPU when I/O operation complete • Direct memory access (DMA) • DMA controller performes “Programmed I/O”, not CPU. • CPU notified with DMA complete CS422S: Operating Systems Organization
I/O Operations and Interrupts (a) Steps in starting an I/O and receiving interrupt (b) How the CPU is interrupted (a) (b) CS422S: Operating Systems Organization
Instruction Cycle with Interrupts Interrupt Cycle Execute Cycle Fetch Cycle Interrupts Disabled Check for & Process Int Fetch Next Instruction Execute Instruction START Interrupts Enabled HALT CS422S: Operating Systems Organization
Buses • Structure of a large Pentium system CS422S: Operating Systems Organization
Basic Operating System Concepts • Processes • Deadlocks • Memory Management • Input/Output • Files • Security • The Shell • Policy versus Mechanism CS422S: Operating Systems Organization
What is A Process? • A process is a program in execution. A process needs resources (CPU time, memory, files, I/O devices) to accomplish task. • Process management activities: • creation and deletion. • suspension and resumption. • Mechanisms for synchronization, communication and deadlock handling CS422S: Operating Systems Organization
Processes - An Introduction • A process tree • A created two child processes, B and C • B created three child processes, D, E, and F CS422S: Operating Systems Organization
Process Memory Space • Processes have three segments: text, data, stack CS422S: Operating Systems Organization
Deadlock - An Introduction (a) A potential deadlock. (b) an actual deadlock. CS422S: Operating Systems Organization
Example File System Structure File system for a university department CS422S: Operating Systems Organization
File Systems • Before mounting, • files on floppy are inaccessible • After mounting floppy on b, • files on floppy are part of file hierarchy CS422S: Operating Systems Organization
Inter-Process Communication Two processes connected by a pipe CS422S: Operating Systems Organization
System Calls • Interface between running program and the operating system • Generally written in assembly-language • Wrapper libraries provide high-level interface • Three general methods are used to pass parameters: • Pass parameters in registers. • Store the parameters in a table in memory. • Push (store) the parameters onto the stack by the program. CS422S: Operating Systems Organization
Steps in Making a System Call There are 11 steps in making the system call read (fd, buffer, nbytes) CS422S: Operating Systems Organization
Some System Calls For Process Management CS422S: Operating Systems Organization
Some System Calls For File Management CS422S: Operating Systems Organization
Some System Calls For Directory Management CS422S: Operating Systems Organization
Some System Calls For Miscellaneous Tasks CS422S: Operating Systems Organization
System Calls - Process Management • A stripped down shell: while (TRUE) { /* repeat forever */ type_prompt( ); /* display prompt */ read_command (command, parameters) /* input from terminal */ if (fork() != 0) { /* fork child process */ /* Parent code */ waitpid( -1, &status, 0); /* wait for child to exit */ } else { /* Child code */ execve (command, parameters, 0); /* execute command */ }} CS422S: Operating Systems Organization
System Calls (a) Two directories before linking/usr/jim/memo to ast's directory (b) The same directories after linking CS422S: Operating Systems Organization
System Calls (a) File system before the mount (b) File system after the mount CS422S: Operating Systems Organization
System Calls Some Win32 API calls CS422S: Operating Systems Organization
Monolithic Design Simple structuring model for a monolithic system CS422S: Operating Systems Organization
Layered Design Structure of the THE operating system CS422S: Operating Systems Organization
Virtual Machines Structure of VM/370 with CMS CS422S: Operating Systems Organization
Client-Server Model The client-server model CS422S: Operating Systems Organization
Microkernel Design The client-server model in a distributed system CS422S: Operating Systems Organization
Policy Versus Mechanism • Policy (What) - Specifies desired behavior or What should occur • Mechanisms (How) - how the policy is carried out - implementation of core processing. • The separation of policy from mechanism is a very important principle, it allows maximum flexibility if policy decisions are to be changed later. CS422S: Operating Systems Organization
Metric Units The metric prefixes CS422S: Operating Systems Organization