2 Outline Functional overview of an operating system Process management Resource allocationCPU allocationMemory allocationInterprocess communication
3 Operating System Overview Operating System Management FunctionsOperating 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 FunctionsThe operating system manages:Hardware resourcesUsers and their programs
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 allocationCPU allocationMemory allocationInterprocess 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 numberThe current state of the processEvents for which the process is waitingResources allocated exclusively to the processMachine resources consumedProcess ownership and/or access privilegesScheduling priority
14 Process Management Threads A portion of a process that can be scheduled and executed independently.Process lightThread can execute concurrently on a single processor or simultaneously on multiple processors.
15 Outline Functional overview of an operating system Process management Resource allocationCPU allocationMemory allocationInterprocess communication
16 Resource Allocation Single Process Resource Allocation Multiple Process Resource AllocationResource Allocation ProcessesReal 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 processesPrevent processes from interfering with one anotherEfficiently 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 AllocationThread StatesInterrupt ProcessingScheduling
25 CPU AllocationA 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.
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 normallyAn interrupt occursBlock 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.
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.
35 Scheduling Priority-Based Scheduling Methods: First come First served Explicit priorityShortest 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 threadAssign 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.
43 Memory AllocationSingle-Tasking Memory Allocation – Contiguous Memory AllocationThe 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.
45 Memory AllocationSingle-Tasking Memory Allocation – Noncontiguous Memory AllocationTo conserve physical memory, some operating system components are loaded into memory only when needed.When loaded, they usually are placed in upper memory.
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.
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.
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.
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.
62 Outline Functional overview of an operating system Process management Resource allocationCPU allocationMemory allocationInterprocess communication
63 Interprocess Communication Interprocess SignalsInterprocess Data Communication
64 Interprocess Communication Interprocess SignalsA 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.
71 SummaryAn 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 SummaryApplication 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 SummaryMemory 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 SummaryProcesses and threads often need to synchronize their actions or transfer data among themselves using signals and pipes.