Download Chapter-3-OpratingSystemSupport

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Library (computing) wikipedia , lookup

RSTS/E wikipedia , lookup

Berkeley Software Distribution wikipedia , lookup

Burroughs MCP wikipedia , lookup

Mobile operating system wikipedia , lookup

Plan 9 from Bell Labs wikipedia , lookup

CP/M wikipedia , lookup

VS/9 wikipedia , lookup

Copland (operating system) wikipedia , lookup

Unix security wikipedia , lookup

DNIX wikipedia , lookup

Spring (operating system) wikipedia , lookup

Process management (computing) wikipedia , lookup

Security-focused operating system wikipedia , lookup

Kernel (operating system) wikipedia , lookup

Distributed operating system wikipedia , lookup

Thread (computing) wikipedia , lookup

Transcript
OPERATING SYSTEM SUPPORT
OPERATING SYSTEM
SUPPORT






Introduction
The Operating System Layer
Protection
Processes and Threads
Communication and Invocation
Operating System Architecture
1
OPERATING SYSTEM SUPPORT
Introduction
 Many distributed operating systems have
been investigated, but there are none in
general/wide use.
 But network operating system are in wide
use for various reasons both technical and
non-technical.
 Users have much invested in their
application software; they will not adopt a
new operating system that will not run their
applications.
2
OPERATING SYSTEM SUPPORT
Introduction
 The second reason against the adoption of
distributed operating system is that users
tend to prefer to have a degree of
autonomy for their machines, even in a
organization.
 Unix and Windows are two examples of network
operating systems.
 Those have a networking capability built into
them and so can be used to access remote
resources using basic services such as rlogin
and telnet.
3
OPERATING SYSTEM SUPPORT
Introduction
 The combination of middleware and
network operating systems provides an
acceptance balance between the
requirement of autonomy and network
transparency.
 The network operating systems allows
users to run their favorite word processor
and other standalone applications.
4
OPERATING SYSTEM SUPPORT
The Operating System Layer
Applic ations, services
Middle w are
OS: kernel,
lib raries &
servers
OS1
Processes, threads,
communicatio n, ...
OS2
Processes, threads,
communicatio n, ...
Computer &
netw ork hardw are
Computer &
netw ork hardw are
Node 1
Node 2
Pla tform
Figure 1. System layers
5
OPERATING SYSTEM SUPPORT
The Operating System Layer
 Figure 1 shows how the operating system
layer at each of two nodes supports a
common middleware layer in providing a
distributed infrastructure for applications
and services.
 Kernels and server processes are the
components that manage resources and
present clients with an interface to the
resources.
6
OPERATING SYSTEM SUPPORT
The Operating System Layer
 The OS facilitates:
 Encapsulation
 Protection
 Concurrent processing
 Invocation mechanism is a means of
accessing an encapsulated resource.
7
OPERATING SYSTEM SUPPORT
The Operating System Layer
Proc es s manager
Communic ation
manager
Thread manager
Memory manager
Supervisor
Figure 2. Core OS functionality
8
OPERATING SYSTEM SUPPORT
Process Manager: handles the creation of and operations
upon processes.
Thread manager: Thread Creation, Synchronization and
Scheduling. Threads are schedulable activities attached to
processes
Communication Manager: manages communication between
threads attached to different processes on the same computer.
Communication between threads in remote processes.
Memory Manager: management of physical and virtual memory
Supervisor: Dispatching of interrupts, system call traps and
other exceptions; control of memory management unit and
hardware caches. Processor and floating point unit register
manipulations.
9
OPERATING SYSTEM SUPPORT
Protection
Resources require protection from illegitimate
access
File protection by providing access privileges
Hardware supports to protect modules: hard lock
Kernel can control the memory management unit
and set of processor registers so that no other
code may access the machine’s physical
resources except in acceptable way.
10
OPERATING SYSTEM SUPPORT
Processes and Threads
 Process
 A process consists of an execution
environment together with one or more
threads.
 A thread is the operating system
abstraction of an activity.
 An execution environment is the unit of
resource management: a collection of local
kernel managed resources to which its
threads have access.
11
OPERATING SYSTEM SUPPORT
Processes and Threads
 An execution environment consists of :
 An address space
 Thread synchronization and communication
resources (e.g., semaphores, sockets)
 Higher-level resources (e.g., file systems,
windows)
12
OPERATING SYSTEM SUPPORT
Processes and Threads
 Threads
 Threads are schedulable activities
attached to processes.
 The aim of having multiple threads of
execution is :
 To maximize degree of concurrent execution
between operations
 To enable the overlap of computation with
input and output
 To enable concurrent processing on
multiprocessors.
13
OPERATING SYSTEM SUPPORT
Processes and Threads
 Threads can be helpful within servers:
 Concurrent processing of client’s requests
can reduce the tendency for servers to
become bottleneck.
• E.g. one thread can process a client’s request
while a second thread serving another request
waits for a disk access to complete.
 Processes vs. Threads
 Threads are “lightweight” processes,
 processes are expensive to create but
threads are easier to create and destroy.
14
OPERATING SYSTEM SUPPORT
Processes and Threads
 Thread synchronization
 The main difficult issues in multi-threaded
programming are the sharing of objects
and the techniques used for thread
coordination and cooperation.
 Each thread’s local variables in methods
are private to it.
 Threads have private stack.
 Threads do not have private copies of
static (class) variables or object instance
variables.
19
OPERATING SYSTEM SUPPORT
Processes and Threads
 Java provides the synchronized keyword
for thread coordination.
 any object can only be accessed through
one invocation of any of its synchronized
methods.
 an object can have synchronized and nonsynchronized methods.
 example
 synchronized addTo() and removeFrom()
methods to serialize requests in worker pool
example.
20
OPERATING SYSTEM SUPPORT
Processes and Threads
 Threads can be blocked and woken up
 The thread awaiting a certain condition calls
an object’s wait() method.
 The other thread calls notify() or notifyAll()
to awake one or all blocked threads.
 example
 When a worker thread discovers that there
are no requests to process, it calls wait() on
the instance of Queue.
 When the I/O thread adds a request to the
queue, it calls the queue’s notify() method
to wake up the worker.
21
OPERATING SYSTEM SUPPORT
Client and server with threads
Thread 2 makes
requests to server
Thread 1
generates
results
Input-output
Receipt &
queuing
T1
Requests
N threads
Client
Server
22
OPERATING SYSTEM SUPPORT
Communication and Invocation
RMI, RPC, Events/Notifications Review
OS Communication: what, which protocols
Communication Primitive: doOperation,
getRequest and sendReply
Protocols and Openness: most OS in 1980s
incorporated their own network protocols tuned
to RPC interactions
23
OPERATING SYSTEM SUPPORT
Invocation Performance
Client and Server may make many millions of
invocation related operations in their life times.
However the network bandwidth improves
invocation times have not decreased in
proportion.
NULL RPC is defined as an RPC without
parameters that executes a null procedure and
returns no values.
Its execution involves an exchange of
messages carrying some system data but not
user data.
24
OPERATING SYSTEM SUPPORT
Invocation Performance
Null Invocation costs are important because
they measure a fixed overhead, the latency.
Invocation cost increase with the size of
arguments and results, but in many cases the
latency is significant compared with the
remainder of delay.
RPC bandwidth/throughput is also concern
when data has to be transferred in bulk.
25
OPERATING SYSTEM SUPPORT
Invocation Performance
Marshalling: and unmarshalling which involve
copying and converting data become significant
when amount of data grows.
Data copying: message data is copied several
times in the course of RPC like from across the
user-kernel boundary, across each protocol
layer, between network interface and kernel
buffers.
Packet initialization: initializing protocol
headers and trailers including checksums
Thread Scheduling and Context switching
26
OPERATING SYSTEM SUPPORT
Operating System Architecture
 The major kernel architectures:
 Monolithic kernels
 Micro-kernels
 Monolithic Kernels
 A monolithic kernel can contain some
server processes that execute within its
address space, including file servers and
some networking.
 The code that these processes execute is
part or the standard kernel configuration.
(Figure 5)
27
OPERATING SYSTEM SUPPORT
Operating System Architecture
 Microkernel
 The microkernel appears as a layer
between hardware layer and a layer
consisting of major systems.
 If performance is the goal, rather than
portability, then middleware may use the
facilities of the microkernel directly.
(Figure 6)
28
OPERATING SYSTEM SUPPORT
Operating System Architecture
S4
.......
S1
S1
Key:
Server:
S2
S3
S2
S3
S4
.......
.......
Monolithic Kernel
Kernel code and data:
Microkernel
Dy namic ally loaded s erv er program:
Figure 5. Monolithic kernel and microkernel
29
OPERATING SYSTEM SUPPORT
Operating System Architecture
Middle w are
Language
support
subsystem
Language
support
subsystem
OS emula tio n
subsystem
....
Microkernel
Hardw are
The microkernel supports middleware via subsystems
Figure 6. The role of the microkernel
30
OPERATING SYSTEM SUPPORT
Operating System Architecture
 Monolithic and Microkernel comparison
 The advantages of a microkernel
 extensibility
 Its ability to enforce modularity behind
memory protection boundaries.
 Its small kernel has less complexity.
 The advantages of a monolithic
 The relative efficiency with which operations
can be invoked because even invocation to
a separate user-level address space on the
same node is more costly.
31
OPERATING SYSTEM SUPPORT
Operating System Architecture
 Hybrid Approaches
 Pure microkernel operating system such as
Chorus & Mach have changed over a time to
allow servers to be loaded dynamically into the
kernel address space or into a user-level
address space.
 In some operating system such as SPIN, the
kernel and all dynamically loaded modules
grafted onto the kernel execute within a single
address space.
32