Presentation is loading. Please wait.

Presentation is loading. Please wait.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.1 Operating System Concepts Operating Systems Lecture 7 OS System Structure.

Similar presentations


Presentation on theme: "Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.1 Operating System Concepts Operating Systems Lecture 7 OS System Structure."— Presentation transcript:

1 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.1 Operating System Concepts Operating Systems Lecture 7 OS System Structure Processes

2 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.2 Operating System Concepts Types of OS structure The design of operating systems has evolved over time. We can roughly divide them into the following categories: 1. Monolithic systems (1st operating systems). 2. Modular systems (E.g. early UNIX) 3. Hierarchical layered systems (e.g. OS/2) 4. Microkernel systems (e.g. Mach) 5. Virtual Machines

3 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.3 Operating System Concepts From monolithic to modular Monolithic systems:  No structure to speak of.  As the OS grows, the complexity becomes overwhelming.  Example: OS/360 version 1  created by 5000 programmers over 5 years.  In 1964, had over 1 million lines of code. Modular systems:  Divide OS into modules.  Example: Original UNIX had 2 modules.  System programs (e.g. emacs, compiler)  The kernel (HUGE!)--file system, CPU scheduling, memory management, etc.  Problem: Kernel so big and complex that it was hard to work with and extend.

4 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.4 Operating System Concepts Layered Systems Hierarchical Layered Systems:  Bottom layer: Hardware  Top layer: User interface  Easier to debug (can work on single layer)  Goal: Allow one layer to change without needing to change other layers.  Example: OS/2, some newer versions of UNIX  Problems:  Division of layers can be difficult to define.  Efficiency: Each layer adds overhead.  Modification still proved difficult. Many interfaces exist between two layers.

5 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.5 Operating System Concepts Microkernels Microkernels:  Define kernel as small as possible.  Kernel is the ONLY code that is machine/device dependent.  Implement the rest of the OS as user processes.  Uses client-server communication model (message passing).  Advantages: (will discuss in class)  Modularity (Easy to modify modules)  Extensibility (Can easily add new functions--user processes)  Flexibility (Can remove functions that are not needed)  Portability (Only the small kernel has hardware specific code)  Distributed System support (Message passing can generalize to network communications)  Object oriented (A good design).  Disadvantages: (will discuss in class)  Performance: create/send receive message takes longer than a system call. Efficiency still a problem.

6 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.6 Operating System Concepts Virtual Machines Virtual Machines:  Provides software interface identical to underlying bare hardware.  Virtual CPU, Virtual Device drivers, Virtual memory, etc.  Each process has its own virtual machine  Implementation provides interface between virtual machine and real machine.  Physical resources divided up between the virtual machines (e.g. minidisks).  Advantages: (will discuss in class)  Security (no process has direct access to system resources.)  System development (Can use virtual machine to test new OS)  System compatibility. Can run Windows on Virtual PC on Mac.  Java runs on Java virtual machine--cross platform.  Disadvantage: (will discuss in class)  Speed: Each instruction is interpreted. This is slower than a direct system call.

7 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.7 Operating System Concepts Virtual Machine Diagram Non-virtual Machine Virtual Machine

8 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.8 Operating System Concepts 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

9 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.9 Operating System Concepts Processes Process – a program in execution; A process includes: (will discuss in class)  program code (text section)  program counter  contents of registers  Process stack (temporary data, e.g. method parameters, etc.)  data section (eg. global variables).

10 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.10 Operating System Concepts 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.

11 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.11 Operating System Concepts Diagram of Process State We will create this in class.

12 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.12 Operating System Concepts Process Control Block (PCB) Information associated with each process is stored in PCB. Process state  new, running, etc. Program counter  address of next instruction to be executed CPU registers  E.g. accumulator, stack pointers, general purpose registers. CPU scheduling information  Process priority, elapsed time, etc. Memory-management information  E.g. base and limit registers Accounting information  E.g. amount of CPU time used, account number, etc. I/O status information  I/O devices allocated, list of open files, etc.

13 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.13 Operating System Concepts Process Control Block (PCB) The PCB is constructed at process creation. PCB includes a pointer to be used in lists (queues) of PCBs. The PCB is used to save information about a process when switched out of CPU.

14 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.14 Operating System Concepts CPU Switch From Process to Process We will diagram this in class.

15 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.15 Operating System Concepts Process Scheduling Queues As processes move between states, they join other processes waiting for particular resources (e.g. CPU time, I/O device, etc.) The Operating System keeps lists of processes in queues (linked lists).  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.  Process state list -- list of processes in each state  Event queues -- list of processes waiting for an event.

16 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.16 Operating System Concepts Ready Queue And Various I/O Device Queues

17 Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.17 Operating System Concepts Representation of Process Scheduling


Download ppt "Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.1 Operating System Concepts Operating Systems Lecture 7 OS System Structure."

Similar presentations


Ads by Google