mmm
Shared by: ert554898
-
Stats
- views:
- 2
- posted:
- 8/27/2012
- language:
- English
- pages:
- 48
Document Sample


Operating Systems
Chapter 11
Systems Architecture, Fourth Edition 1
Objectives
• Describe the functions and layers of an operating system
• List the resources allocated by the operating system and
describe the complexities of the allocation process
• Describe how an operating system manages processes
and threads
• Compare and contrast alternative CPU scheduling
methods
• Explain how the operating system manages memory
• Describe signals and pipes and how they coordinate
threads and processes
Systems Architecture, Fourth Edition 2
Chapter Topics
Systems Architecture, Fourth Edition 3
Operating System Overview
Operating System Management
Functions:
• Oversees all hardware resources and
allocates them to user and applications as
needed
• Performs many low-level tasks on behalf
of users and application programs
Systems Architecture, Fourth Edition 4
Operating System Overview
Systems Architecture, Fourth Edition 5
Operating System Overview
Operating System Layers:
• Command Layer (shell) – 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
Systems Architecture, Fourth Edition 6
Operating System Overview
Systems Architecture, Fourth Edition 7
Operating System Overview
Systems Architecture, Fourth Edition 8
Resource Allocation
Resource Allocation Process:
• Keeps detailed records of available resources
• Knows which resources 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
Systems Architecture, Fourth Edition 9
Resource Allocation
Single Process Resource Allocation
(application program and operating
system):
• When an application program begins
executing, the operating system grants it
control of all unused resources
• Most service calls are actually indirect
requests for system resources
Systems Architecture, Fourth Edition 10
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
• 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
Systems Architecture, Fourth Edition 11
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
Systems Architecture, Fourth Edition 12
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
Systems Architecture, Fourth Edition 13
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.
Systems Architecture, Fourth Edition 14
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
Systems Architecture, Fourth Edition 15
CPU Allocation
Concurrent Execution (Interleaved
Execution):
– A thread is a portion of a process that can be
scheduled and executed independently.
– It controls the CPU for no more than a few
milliseconds before it relinquishes control and
the operating system gives another thread a
turn
Systems Architecture, Fourth Edition 16
CPU Allocation
Systems Architecture, Fourth Edition 17
CPU Allocation
1. Ready State – a thread is waiting for access
to a CPU
2. Block State – the thread is suspended while
an interrupt is being processed
3. Running State – the thread has control of
the CPU.
– The thread or its parent process terminates
normally
– An interrupt occurs
Systems Architecture, Fourth Edition 18
CPU Allocation
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
Systems Architecture, Fourth Edition 19
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
Systems Architecture, Fourth Edition 20
CPU Allocation
Systems Architecture, Fourth Edition 21
CPU Allocation
Systems Architecture, Fourth Edition 22
Technology Focus
Systems Architecture, Fourth Edition 23
CPU Allocation
Priority-Based:
• First-come first served:
– The scheduler always dispatches the ready
thread that has been waiting the longest.
• Explicit priority:
– Uses a set of priority levels and assigns a
level to each process or thread.
Systems Architecture, Fourth Edition 24
CPU Allocation
Shortest Remaining Time:
Chooses the next process to be
dispatched based on the expected amount
of CPU time needed to complete the
process.
Systems Architecture, Fourth Edition 25
Technology Focus
Systems Architecture, Fourth Edition 26
Memory Allocation
• Single-Tasking Memory Allocation
• Multitasking Memory Allocation
• Memory Fragmentation
• Noncontiguous Memory Allocation
• Virtual Memory Management
• Memory Protection
• Memory Management Hardware
Systems Architecture, Fourth Edition 27
Memory Allocation
Systems Architecture, Fourth Edition 28
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.
Systems Architecture, Fourth Edition 29
Memory Allocation
Systems Architecture, Fourth Edition 30
Memory Allocation
Multitasking Memory Allocation:
• 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.
Systems Architecture, Fourth Edition 31
Memory Allocation
Systems Architecture, Fourth Edition 32
Memory Allocation
Systems Architecture, Fourth Edition 33
Memory Allocation
Systems Architecture, Fourth Edition 34
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
Systems Architecture, Fourth Edition 35
Memory Allocation
Systems Architecture, Fourth Edition 36
Memory Allocation
Systems Architecture, Fourth Edition 37
Memory Allocation
Systems Architecture, Fourth Edition 38
Memory Allocation
Systems Architecture, Fourth Edition 39
Technology Focus
Systems Architecture, Fourth Edition 40
Technology Focus
Systems Architecture, Fourth Edition 41
Interprocess Communication
Systems Architecture, Fourth Edition 42
Interprocess Communication
Systems Architecture, Fourth Edition 43
Interprocess Communication
Systems Architecture, Fourth Edition 44
Interprocess Communication
Systems Architecture, Fourth Edition 45
Interprocess Communication
Systems Architecture, Fourth Edition 46
Summary
• The operating system is complex software that
allocates hardware resources to individual user
processes on demand
• The operating system stores information about
each process in a PCB
• Application software is simper to develop if
programs are unaware of resource allocation
functions
Systems Architecture, Fourth Edition 47
Summary
• An active thread is always in one of three states
– ready, running, or blocked
• 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
• Processes and threads often need to
synchronize their actions or transfer data among
themselves using signals and pipes
Systems Architecture, Fourth Edition 48
Get documents about "