Principles of Operating Systems - I/O Structures and Storage 1 ICS 143 - Principles of Operating Systems Operating Systems - Review Prof. Dmitri V. Kalashnikov dvk (@) ics.uci.edu Slides © Prof. Nalini Venkatasubramanian.Principles of Operating Systems - I/O Structures and Storage 2 What is an Operating System? ❚ An OS is a program that acts an intermediary between the user of a computer and computer hardware. ❚ Major cost of general purpose computing is software. ❙ OS simplifies and manages the complexity of running application programs efficiently.Principles of Operating Systems - I/O Structures and Storage 3 Operating System Views ❚ Resource allocator ❘ to allocate resources (software and hardware) of the computer system and manage them efficiently. ❚ Control program ❘ Controls execution of user programs and operation of I/O devices. ❚ Kernel ❘ The program that executes forever (everything else is an application with respect to the kernel).Principles of Operating Systems - I/O Structures and Storage 4 Operating System Spectrum ❚ Monitors and Small Kernels ❚ Batch Systems • Polling vs. interrupt ❚ Multiprogramming ❚ Timesharing Systems • concept of timeslice ❚ Parallel and Distributed Systems • symmetric vs. asymmetric multiprocessing ❚ Real-time systems • Hard vs. soft realtimePrinciples of Operating Systems - I/O Structures and Storage 5 Computer System Structures ❚ Computer System Operation ❚ I/O Structure ❚ Storage Structure ❙ Storage Hierarchy ❚ Hardware Protection ❚ General System Architecture ❚ System Calls and System Programs ❚ Command InterpreterPrinciples of Operating Systems - I/O Structures and Storage 6 Operating System Services ❚ Services that provide user-interfaces to OS ❘ Program execution - load program into memory and run it ❘ I/O Operations - since users cannot execute I/O operations directly ❘ File System Manipulation - read, write, create, delete files ❘ Communications - interprocess and intersystem ❘ Error Detection - in hardware, I/O devices, user programs ❚ Services for providing efficient system operation ❘ Resource Allocation - for simultaneously executing jobs ❘ Accounting - for account billing and usage statistics ❘ Protection - ensure access to system resources is controlledPrinciples of Operating Systems - I/O Structures and Storage 7 Process Management ❚ Process - fundamental concept in OS ❘ Process is a program in execution. ❘ Process needs resources - CPU time, memory, files/data and I/O devices. ❚ OS is responsible for the following process management activities. ❘ Process creation and deletion ❘ Process suspension and resumption ❘ Process synchronization and interprocess communication ❘ Process interactions - deadlock detection, avoidance and correctionPrinciples of Operating Systems - I/O Structures and Storage 8 Process Concept ❙ An operating system executes a variety of programs ❘ batch systems - jobs ❘ time-shared systems - user programs or tasks ❘ job and program used interchangeably ❙ Process - a program in execution ❘ process execution proceeds in a sequential fashion ❙ A process contains ❘ program counter, stack and data section ❙ Process States ❘ e.g. new, running, ready, waiting, terminated.Principles of Operating Systems - I/O Structures and Storage 9 Process Control Block ❚ Contains information associated with each process • Process State - e.g. new, ready, running etc. • Program Counter - address of next instruction to be executed • CPU registers - general purpose registers, stack pointer etc. • CPU scheduling information - process priority, pointer • Memory Management information - base/limit information • Accounting information - time limits, process number • I/O Status information - list of I/O devices allocatedPrinciples of Operating Systems - I/O Structures and Storage 10 Schedulers ❚ Long-term scheduler (or job scheduler) - • selects which processes should be brought into the ready queue. • invoked very infrequently (seconds, minutes); may be slow. • controls the degree of multiprogramming ❚ Short term scheduler (or CPU scheduler) - • selects which process should execute next and allocates CPU. • invoked very frequently (milliseconds) - must be very fast ❚ Medium Term Scheduler • swaps out process temporarily • balances load for better throughputPrinciples of Operating Systems - I/O Structures and Storage 11 Process Creation ❚ Processes are created and deleted dynamically ❚ Process which creates another process is called a parent process; the created process is called a child process. ❚ Result is a tree of processes ❘ e.g. UNIX - processes have dependencies and form a hierarchy. ❚ Resources required when creating process ❘ CPU time, files, memory, I/O devices etc.Principles of Operating Systems - I/O Structures and Storage 12 Process Termination ❚ Process executes last statement and asks the operating system to delete it (exit). • Output data from child to parent (via wait). • Process’ resources are deallocated by operating system. ❚ Parent may terminate execution of child processes. • Child has exceeded allocated resources. • Task assigned to child is no longer required. • Parent is exiting – OS does not allow child to continue if parent terminates – Cascading terminationPrinciples of Operating Systems - I/O Structures and Storage 13 Producer-Consumer Problem ❚ Paradigm for cooperating processes; ❙ producer process produces information that is consumed by a consumer process. ❚ We need buffer of items that can be filled by producer and emptied by consumer. • Unbounded-buffer places no practical limit on the size of the buffer. Consumer may wait, producer never waits. • Bounded-buffer assumes that there is a fixed buffer size. Consumer waits for new item, producer waits if buffer is full. ❙ Producer and Consumer must synchronize.Principles of Operating Systems - I/O Structures and Storage 14 Threads ❚ Processes do not share resources well • high context switching overhead ❚ A thread (or lightweight process) • basic unit of CPU
View Full Document