1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those.
Published byModified over 4 years ago
Presentation on theme: "1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those."— Presentation transcript:
1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating Systems Concepts with Java, by Silberschatz, Galvin, and Gagne (2003). Many, if not all, the illustrations contained in this presentation come from this source.
1/28/2004CSCI 315 Operating Systems Design2 System Programs System programs provide a convenient environment for program development and execution. They can be divided into: –File manipulation –Status information –File modification –Programming language support –Program loading and execution –Communications –Application programs Most users’ view of the operation system is defined by system programs, not the actual system calls.
1/28/2004CSCI 315 Operating Systems Design3 UNIX System Structure UNIX – limited by hardware functionality, the original UNIX operating system had limited structuring. The UNIX OS consists of two separable parts: –Systems programs, and –The kernel: Consists of everything below the system-call interface and above the physical hardware, Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level.
1/28/2004CSCI 315 Operating Systems Design4 UNIX System Structure
1/28/2004CSCI 315 Operating Systems Design5 Layered Approach The operating system is divided into a number of layers (levels), each built on top of lower layers. The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface. With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers.
1/28/2004CSCI 315 Operating Systems Design6 An Operating System Layer
1/28/2004CSCI 315 Operating Systems Design7 Microkernel System Structure Moves as much from the kernel into “user” space. Communication takes place between user modules using message passing. Benefits: –Easier to extend a microkernel, –Easier to port the operating system to new architectures, –More reliable (less code is running in kernel mode), –More secure. Detriments: –Performance overhead of user space to kernel space communication.
1/28/2004CSCI 315 Operating Systems Design8 Modules Most modern operating systems implement kernel modules: –Uses object-oriented approach, –Each core component is separate, –Each talks to the others over known interfaces, and –Each is loadable as needed within the kernel. Overall, similar to layers but with more flexibility.
1/28/2004CSCI 315 Operating Systems Design9 Virtual Machines A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the operating system kernel as though they were all hardware. A virtual machine provides an interface identical to the underlying bare hardware. The operating system creates the illusion of multiple processes, each executing on its own processor with its own (virtual) memory.
1/28/2004CSCI 315 Operating Systems Design10 Virtual Machines (Cont.) The resources of the physical computer are shared to create the virtual machines: –CPU scheduling can create the appearance that users have their own processor, –Spooling and a file system can provide virtual card readers and virtual line printers, –A normal user time-sharing terminal serves as the virtual machine operator’s console.
1/28/2004CSCI 315 Operating Systems Design11 System Models Non-virtual Machine Virtual Machine
1/28/2004CSCI 315 Operating Systems Design12 [Ad|Disad]vantages of Virtual Machines The virtual-machine concept provides complete protection of system resources since each virtual machine is isolated from all other virtual machines. This isolation, however, permits no direct sharing of resources. A virtual-machine system is a perfect vehicle for operating- systems research and development. System development is done on the virtual machine, instead of on a physical machine and so does not disrupt normal system operation. The virtual machine concept is difficult to implement due to the effort required to provide an exact duplicate to the underlying machine.
1/28/2004CSCI 315 Operating Systems Design13 Java Virtual Machine Compiled Java programs are platform-neutral bytecodes executed by a Java Virtual Machine (JVM). JVM consists of: – Class loader, –Class verifier, –Runtime interpreter. Just-In-Time (JIT) compilers increase performance.
1/28/2004CSCI 315 Operating Systems Design14 The Java Virtual Machine
1/28/2004CSCI 315 Operating Systems Design15 Operating System Design Goals User goals – operating system should be convenient to use, easy to learn, reliable, secure, and fast. System goals – operating system should have a simple design, be easy to implement, and maintain, as well as be flexible, reliable, error-free, and efficient.
1/28/2004CSCI 315 Operating Systems Design16 System Implementation Traditionally written in assembly language, operating systems can now be written in higher-level languages. Code written in a high-level language: –Can be written faster, –Is more compact, and –Is easier to understand and debug. An operating system is far easier to port (move to some other hardware) if it is written in a high-level language.
1/28/2004CSCI 315 Operating Systems Design17 Chapter 4 Processes
1/28/2004CSCI 315 Operating Systems Design18 Process Concept Process – a program in execution; process execution must progress in sequential fashion. A process includes: –program counter, –stack, –data section. heap stack data code program counter
1/28/2004CSCI 315 Operating Systems Design19 Process State As a process executes, it changes state: –new: The process is being created. –running: Instructions are being executed. –waiting: The process is waiting for some event to occur. –ready: The process is waiting to be assigned to a process. –terminated: The process has finished execution.
1/28/2004CSCI 315 Operating Systems Design20 Process State Transition Diagram new ready terminated running waiting admitted interrupt exit scheduler dispatch I/O or event waitI/O or event completion
1/28/2004CSCI 315 Operating Systems Design21 Process Control Block (PCB) OS bookkeeping information associated with each process: Process state, Program counter, CPU registers, CPU scheduling information, Memory-management information, Accounting information, I/O status information, process id process state program counter registers memory limits list of open files
1/28/2004CSCI 315 Operating Systems Design22 CPU Switching
1/28/2004CSCI 315 Operating Systems Design23 Process Scheduling Queues Job queue – set of all processes in the system. Ready queue – set of all processes residing in main memory, ready and waiting to execute. Device queues – set of processes waiting for an I/O device. Processes migrate between the various queues.
1/28/2004CSCI 315 Operating Systems Design24 Processes and OS Queues
1/28/2004CSCI 315 Operating Systems Design25 Process Scheduling CPU ready queue I/O I/O queueI/O request time slice expired fork a child wait for interrupt interrupt occurs child executes