Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 11 Operating Systems

Similar presentations


Presentation on theme: "Chapter 11 Operating Systems"— Presentation transcript:

1 Chapter 11 Operating Systems

2 Outline Functional overview of an operating system Process management
Resource allocation CPU allocation Memory allocation Interprocess communication

3 Operating System Overview
Operating System Management Functions Operating System Layers

4 Operating System Overview
The operating system oversees all hardware resources and allocates them to user and applications as needed. The operating system performs many low-level tasks on behalf of users and application programs.

5 Operating System Overview
Operating System Management Functions The operating system manages: Hardware resources Users and their programs

6

7 Operating System Overview
Operating System Layers Command Layer Service Layer Kernel

8 Operating System Layers

9 Operating System Layers
Command Layer – the user’s interface to the operating system. Service Layer – contains a set of functions called by application programs and the command layer. Kernel – manages resources and directly interacts with computer hardware.

10 Outline Functional overview of an operating system Process management
Resource allocation CPU allocation Memory allocation Interprocess communication

11 Process Management Process Control Data Structures
A process is a unit of executing software that is managed independently by the operating system. A process can request and receive hardware resources and operating system services.

12 Process Management Process Control Data Structures
Process Control Block (PCB) – keeps track of each process by creating and updating a data structure. The PCB is created when the process is created, updated when the process changes and deleted when the process terminates.

13 Process Management Data included in a PCB:
A unique process identification number The current state of the process Events for which the process is waiting Resources allocated exclusively to the process Machine resources consumed Process ownership and/or access privileges Scheduling priority

14 Process Management Threads
A portion of a process that can be scheduled and executed independently. Process light Thread can execute concurrently on a single processor or simultaneously on multiple processors.

15 Outline Functional overview of an operating system Process management
Resource allocation CPU allocation Memory allocation Interprocess communication

16 Resource Allocation Single Process Resource Allocation
Multiple Process Resource Allocation Resource Allocation Processes Real and Virtual Resources

17 Resource Allocation Single Process Resource Allocation
Involves only two executing programs – application and operating system. When an application program begins executing, the operating system grants it control of all unused resources.

18 Resource Allocation Single Process Resource Allocation
Most service calls are actually indirect requests for system resources. MS-DOS is a single-tasking operating system.

19 Resource Allocation Multiple Process Resource Allocation
Multitasking operating systems are the norm for general-purpose computers. Multitasking operating systems must be able to handle multiple programs and users.

20 Resource Allocation Multiple Process Resource Allocation
A multitasking operating system manages hardware resources to achieve the following: Meet the resource needs of processes Prevent processes from interfering with one another Efficiently use hardware and other resources

21 Resource Allocation Resource Allocation Processes
Keeps detailed records of available resources. Knows which resource are used to satisfy which requests. Schedules resources based on specific allocation policies to meet present and anticipated demands. Updates records to reflect resources commitment and release by processes and users.

22 Resource Allocation Real and Virtual Resources
Real resource – a computer system’s physical devices and associated system software. Virtual resource – the resources that are apparent to a process or user.

23 Real and Virtual Resources
Providing virtual resources that meet or exceed resources is accomplished by: Rapidly shifting resources unused by one process to other processes that need them. Substituting one type of resource for another when possible and necessary.

24 CPU Allocation Thread States Interrupt Processing Scheduling

25 CPU Allocation A thread controls the CPU for no more than a few milliseconds before it relinquishes control and the operating system gives another thread a turn. CPU sharing is called concurrent execution or interleaved execution.

26 CPU Allocation

27 CPU Allocation Thread States Ready Running Blocked

28 CPU Allocation

29 CPU Allocation Ready State – a thread is waiting for access to a CPU.
Running State – the thread has control of the CPU. The thread or its parent process terminates normally An interrupt occurs Block State – the thread is suspended while an interrupt is being processed.

30 CPU Allocation Interrupt Processing
A blocked thread is waiting for an event to occur. If the event is the correction of an error and it can be corrected, the thread remains in the blocked state until the error condition is resolved; otherwise, the thread is halted.

31 Scheduling Preemptive Scheduling Priority-based Scheduling
Real-time Scheduling

32 Scheduling Preemptive Scheduling
A thread can be removed involuntarily from the running state. A running process controls the CPU by controlling the content of the instruction pointer. CPU control is lost whenever an interrupt is received.

33 Scheduling

34 Scheduling

35 Scheduling Priority-Based Scheduling Methods: First come First served
Explicit priority Shortest time remaining

36 Scheduling Priority-Based: First come first served:
The scheduler always dispatches the ready thread that has been waiting the longest.

37 Scheduling Priority-Based: Explicit priority:
Uses a set of priority levels and assigns a level to each process or thread. The scheduling method can use priority levels in two ways: Always dispatch the highest priority ready thread Assign larger time slices to high priority threads

38 Scheduling Priority-Based: Shortest time remaining:
Chooses the next process to be dispatched based on the expected amount of CPU time needed to complete the process.

39 Scheduling Real-Time Scheduling:
Guarantees a minimum amount of CPU time to a thread if the thread makes an explicit request when it is created. Used when a thread must have enough resources to complete its function within a specified time.

40 Technology Focus Windows 2000 Scheduling

41 Technology Focus

42 Memory Allocation Single-Tasking Memory Allocation
Multitasking Memory Allocation Memory Fragmentation Noncontiguous Memory Allocation Virtual Memory Management Memory Protection Memory Management Hardware

43 Memory Allocation Single-Tasking Memory Allocation – Contiguous Memory Allocation The bulk of the operating system occupies lower memory addresses. The application program is loaded above the operating system. The remaining space is available for user programs and data.

44 Memory Allocation

45 Memory Allocation Single-Tasking Memory Allocation – Noncontiguous Memory Allocation To conserve physical memory, some operating system components are loaded into memory only when needed. When loaded, they usually are placed in upper memory.

46 Memory Allocation

47 Memory Allocation Multitasking Memory Allocation
The goals of multitasking memory allocation are: Allow as many active processes as possible. Respond quickly to changing memory demands of processes. Prevent unauthorized changes to a process’s memory region(s). Implement memory allocation and addressing as efficiently as possible.

48 Memory Allocation

49 Memory Allocation

50 Memory Allocation

51 Memory Allocation Memory Fragmentation
As processes are created, executed, and terminated, memory allocation changes accordingly. Memory partition allocation and deallocation leads to an increasing number of small free partitions separated by allocated partitions.

52 Memory Allocation

53 Memory Allocation

54 Memory Allocation Noncontiguous Memory Allocation
Uses small fixed-size partitions, usually no larger than 64K. A process can be loaded into more than one partition.

55 Memory Allocation

56 Memory Allocation Virtual Memory Management
Divides a program into partitions called pages. Memory is divided into pages called a page frame. During program execution, one or more program pages are stored in a page frame, the remaining are stored on a secondary storage device.

57 Memory Allocation

58 Memory Allocation Memory Protection
Refers to the protection of memory allocated to one program from unauthorized access by another program. The operating system checks each write to a memory location to ensure that the address being written is allocated to the program performing the write operation.

59 Memory Allocation Memory Management Hardware
Modern CPUs and computer systems incorporate advanced memory allocation and address resolution functions in hardware.

60 Technology Focus

61 Technology Focus

62 Outline Functional overview of an operating system Process management
Resource allocation CPU allocation Memory allocation Interprocess communication

63 Interprocess Communication
Interprocess Signals Interprocess Data Communication

64 Interprocess Communication
Interprocess Signals A signal is a message used to synchronize the actions of two processes or threads. Signals can be sent between threads of the same process, between independent processes, or between the operating system and a process or thread.

65 Interprocess Communication

66 Interprocess Communication

67 Interprocess Communication

68 Interprocess Communication
Interprocess Data Communication Operating systems provide a mechanism called a pipe so there can be communication via shared memory between independent processes.

69 Interprocess Communication

70 Interprocess Communication

71 Summary An operating system is the most complex component of system software. The operating system allocates hardware resources to individual user processes on demand. The operating system stores information about each process in a PCB.

72 Summary Application software is simper to develop if programs are unaware of resource allocation functions. An active thread is always in one of three states – ready, running, or blocked.

73 Summary Memory is divided into fixed-size partitions and processes are allocated one or more memory partitions to store instructions and data. Modern operating systems implement a form of memory allocation and management called virtual memory management.

74 Summary Processes and threads often need to synchronize their actions or transfer data among themselves using signals and pipes.


Download ppt "Chapter 11 Operating Systems"

Similar presentations


Ads by Google