Lecture 3 Operating System Structures
Lecture 3 Operating System Structures
Structures of Operating
System
Von Neumann Architecture
2
Von Neumann Architecture
3
4
Components of a Modern OS
Storage
Management
Device
Process Management
Management User
Interface
File Memory
Management Management
5
Process Management
The Operating System must ensure that each
running application (process) is treated fairly
in terms of processor time allocated in a
Multi-Tasking environment
The processor is maximally and efficiently
utilized
6
Storage Management
Disk storage is only one of the memory types
that must be managed by the operating
system, and is the slowest.
The operating system must balance the needs
of the various processes with the availability
of the different types of memory, moving data
in blocks (called pages) between available
memory as the schedule of processes dictates.
7
Memory Management
When an operating system manages the
computer's memory, there are two broad tasks
to be accomplished:
Each process must have enough memory in which to
execute, and it can neither run into the memory space
of another process nor be run into by another process.
The different types of memory in the system must be
used properly so that each process can run most
effectively.
8
Device Management
Managing input and output is largely a matter of
managing queues and buffers, special storage
facilities that take a stream of bits from a device
especially important when a number of processes are
running and taking up processor time
Ex.: OS instructs a buffer to continue taking input
from the device, but to stop sending data to the CPU
while the process using the input is suspended.
9
File Management
A method for storing and organizing
computer files and the data they contain to
make it easy to find and access them.
File systems uses data storage device such as
a hard disk or CD-ROM and involve
maintaining the physical location of the files
10
User Interface
An interface is a set of commands or menus through
which a user communicates with a program.
otherwise regarded as the “shell”
used to indirectly issue commands which are the
handed on to the kernel
one of the most important parts of any program
determines how easily you can make the program do what
you want.
Command-driven or Graphical User
11
Operating System Services
User Interface
Program Execution
Resource Allocation
I/O Manipulation
Communication
Error Detection
Accounting
Protection and Security
12
OS Service: Program Execution
The system must be able to load a program
into memory and to run that program, end
execution, either normally or abnormally
(indicating error)
13
OS Service: Resource Allocation
When multiple users or multiple jobs running
concurrently, resources must be allocated to
each of them
Many types of resources - Some (such as CPU
cycles, main memory, and file storage) may have
special allocation code, others (such as I/O devices)
may have general request and release code.
14
OS Service: I/O Manipulation
A running program may require I/O, which
may involve a file or an I/O device
15
OS Service: Communication
Processes may exchange information, on the
same computer or between computers over a
network
Communications may be via shared memory or
through message passing (packets moved by the OS)
16
OS Service: Error Detection
OS needs to be constantly aware of possible
errors
May occur in the CPU and memory hardware, in I/O
devices, in user program
For each type of error, OS should take the appropriate
action to ensure correct and consistent computing
Debugging facilities can greatly enhance the user’s
and programmer’s abilities to efficiently use the
system
17
OS Service: Accounting
To keep track of which users use how much
and what kinds of computer resources
For what?
Basis for caching
18
OS Service: Protection & Security
The owners of information stored in a multi-user or
networked computer system may want to control use
of that information, concurrent processes should not
interfere with each other
Protection involves ensuring that all access to
system resources is controlled
Security of the system from outsiders requires user
authentication, extends to defending external I/O
devices from invalid access attempts.
19
System Calls
the mechanism used by an application program to
request service from the operating system
On Unix-based and POSIX-based systems, popular
system calls are open, read, write, close, wait, exec,
fork, exit, and kill.
Many of today's operating systems have hundreds of
system calls.
A typical way to implement this is to use a software
interrupt.
20
System Calls
21
System Call Implementation
Typically, a number associated with each system call
System-call interface maintains a table indexed
according to these numbers
The system call interface invokes intended system
call in OS kernel and returns status of the system call
and any return values
The caller need know nothing about how the system
call is implemented
Just needs to obey API and understand what OS will
do as a result call
22
System Call: An Illustration
23
OS Design & Implementation
Design and Implementation of OS not “solvable”,
but some approaches have proven successful
Internal structure of different Operating Systems
can vary widely
Start by defining goals and specifications
User goals and System goals
User goals – operating system should be convenient
to use, easy to learn, reliable, safe, and fast
System goals – operating system should be easy to
design, implement, and maintain, as well as flexible,
reliable, error-free, and efficient
24
OS Design & Implementation
Affected by choice of hardware, type of system
Important principle to separate
Policy: What will be done?
Mechanism: How to do it?
Mechanisms determine how to do something,
policies decide what will be done
The separation of policy from mechanism is a very
important principle, it allows maximum flexibility if
policy decisions are to be changed later
25
OS Structure: 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
26
OS Structure: Virtual Machines
27
JVM
28
OS Structure: Client-Server Model
User process (client) sends a request to server
process
Kernel handles communications between client and
server
Split OS into parts
File service
Process service
Terminal service
Memory service
29
End of Lecture
IT6 - Operating System
Any Question?