operating system support
TRANSCRIPT
![Page 1: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/1.jpg)
Chapter 7
Operating System Support
![Page 2: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/2.jpg)
© 2015 Prof. Amr El-Kadi 1
Outline
• Introduction
• The operating system layer
• Processes and threads
• Communication and invocation
• Operating system architecture
![Page 3: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/3.jpg)
© 2015 Prof. Amr El-Kadi 2
System layers
Applications, services
Computer &
Platform
Middleware
OS: kernel,libraries & servers
network hardware
OS1
Computer & network hardware
Node 1 Node 2
Processes, threads,communication, ...
OS2Processes, threads,communication, ...
![Page 4: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/4.jpg)
© 2015 Prof. Amr El-Kadi 3
Middleware and the Operating
System
• Traditional OS's (e.g. early Unix,
Windows 3.0)
• Network OS's (e.g. modern UNIX,
Windows NT)
• Middleware implements abstractions that
support network-wide programming.
![Page 5: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/5.jpg)
© 2015 Prof. Amr El-Kadi 4
What is a distributed OS?
• Presents users (and applications)
with an integrated computing platform
that hides the individual computers.
• Has control over all of the nodes
(computers) in the network
• In a distributed OS, the user doesn't
know (or care) where his programs
are running.
![Page 6: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/6.jpg)
© 2015 Prof. Amr El-Kadi 5
–Examples:
• Cluster computer systems
• V system, Sprite, Globe OS
• WebOS (?)
![Page 7: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/7.jpg)
© 2015 Prof. Amr El-Kadi 6
The support required by middleware
and distributed applications
• OS manages the basic resources of computer systems
• It is the task of an operating system to:– raise the programming interface for these resources
to a more useful level:
– provide the resources needed for (distributed) services and applications to complete their task
![Page 8: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/8.jpg)
© 2015 Prof. Amr El-Kadi 7
Core OS functionality
Communication
manager
Thread manager Memory manager
Supervisor
Process manager
![Page 9: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/9.jpg)
© 2015 Prof. Amr El-Kadi 8
Copy-on-write – a convenient
optimization
a) Before write b) After write
Shared
frameA's page
table
B's page
table
Process A’s address space Process B’s address space
Kernel
RA RB
RB copied
from RA
![Page 10: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/10.jpg)
© 2015 Prof. Amr El-Kadi 9
Threads concept and
implementationProcess
Thread activations
Activation stacks
(parameters, local variables)
'text' (program code)Heap (dynamic storage,
objects, global variables)
system-provided resources
(sockets, windows, open files)
![Page 11: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/11.jpg)
© 2015 Prof. Amr El-Kadi 10
Client and server with threads
Server
N threads
Input-output
Client
Thread 2 makes
T1
Thread 1
requests to server
generates
results
Requests
Receipt &queuing
![Page 12: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/12.jpg)
© 2015 Prof. Amr El-Kadi 11
Alternative server threading
architectures
a. Thread-per-request b. Thread-per-connection c. Thread-per-object
remote
workers
I/O remoteremote I/O
per-connection threads per-object threads
objects objectsobjects
![Page 13: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/13.jpg)
© 2015 Prof. Amr El-Kadi 12
Threads versus multiple
processes
• Creating a thread is (much) cheaper than a
process (~10-20 times)
• Switching to a different thread in same process
is (much) cheaper (5-50 times)
• Threads within same process can share data
and other resources more conveniently and
efficiently (without copying or messages)
• Threads within a process are not protected from each other
![Page 14: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/14.jpg)
© 2015 Prof. Amr El-Kadi 13
Support for communication and
invocation
• The performance of RPC and RMI mechanisms is
critical for effective distributed systems.
– Typical times for 'null procedure call':
– Local procedure call< 1 microseconds
– Remote procedure call ~ 10 milliseconds
– 'network time' (involving about 100 bytes transferred, at
100 megabits/sec.) accounts for only 0.01 millisecond; the
remaining delays must be in OS and middleware - latency,
not communication time.
![Page 15: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/15.jpg)
© 2015 Prof. Amr El-Kadi 14
Factors affecting RPC/RMI
performance
– marshalling/unmarshalling + operation
despatch at the server
– data copying:- application -> kernel space ->
communication buffers
– thread scheduling and context switching:-
including kernel entry
– protocol processing:- for each protocol layer
– network access delays:- connection setup,
network latency
![Page 16: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/16.jpg)
© 2015 Prof. Amr El-Kadi 15
Implementation of invocation
mechanisms
• Most invocation middleware (Corba, Java RMI, HTTP) are implemented over TCP– For universal availability, unlimited message size and
reliable transfer
– Sun RPC (used in NFS) is implemented over both UDP and TCP
• Research-based systems have implemented much more efficient invocation protocols– Firefly RPC
– Amoeba's doOperation, getRequest, sendReply primitives LRPC
![Page 17: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/17.jpg)
© 2015 Prof. Amr El-Kadi 16
Invocations between address
spacesControl transfer viatrap instruction
User Kernel
Thread
User 1 User 2
Control transfer viaprivileged instructions
Thread 1 Thread 2
Protection domainboundary
(a) System call
(b) RPC/RMI (within one computer)
Kernel
(c) RPC/RMI (between computers)
User 1 User 2
Thread 1 Network Thread 2
Kernel 2Kernel 1
![Page 18: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/18.jpg)
© 2015 Prof. Amr El-Kadi 17
RPC delay against parameter
size
1000 2000
RPC delay
Requested data
size (bytes)
Packet
size
0
![Page 19: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/19.jpg)
© 2015 Prof. Amr El-Kadi 18
Times for serialized and
concurrent invocations
execute request
Send
Receiveunmarshal
marshal
Receiveunmarshal
process results
marshalSend
process args
marshalSend
process args
transmission
Receiveunmarshal
process results
execute request
Send
Receiveunmarshal
marshal
Client Server
Serialized invocations
Client Server
marshalSend
process args
marshalSend
process args
execute request
Send
Receiveunmarshal
marshal
execute request
Send
Receiveunmarshal
marshalReceive
unmarshalprocess results
Receiveunmarshal
process results
time
Concurrent invocations
![Page 20: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/20.jpg)
© 2015 Prof. Amr El-Kadi 19
Monolithic kernel and
microkernel
Monolithic Kernel Microkernel
Server: Dynamically loaded server program:Kernel code and data:
.......
.......
Key:
S4
S1 .......
S1 S2 S3
S2 S3 S4
![Page 21: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/21.jpg)
© 2015 Prof. Amr El-Kadi 20
Middleware
Language
support
subsystem
Language
support
subsystem
OS emulation
subsystem....
Microkernel
Hardware
![Page 22: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/22.jpg)
© 2015 Prof. Amr El-Kadi 21
Advantages and disadvantages
of microkernel
• flexibility and extensibility
• services can be added, modified and debugged
• small kernel -> fewer bugs
• protection of services and resources is still maintained
• service invocation expensive
- unless LRPC is used
- extra system calls by services for access to protected resources
![Page 23: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/23.jpg)
© 2015 Prof. Amr El-Kadi 22
Bershad's LRPC
• Uses shared memory for interprocess
communication
– while maintaining protection of the two
processes
– arguments copied only once (versus four
times for conventional RPC)
• Client threads can execute server code
– via protected entry points only (uses
capabilities)
• Up to 3 x faster for local invocations
![Page 24: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/24.jpg)
© 2015 Prof. Amr El-Kadi 23
A lightweight remote procedure
call
1. Copy args
2. Trap to Kernel
4. Execute procedure
and copy results
Client
User stub
Server
Kernel
stub
3. Upcall 5. Return (trap)
AA stack
![Page 25: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/25.jpg)
24
Figure 7.17
The architecture of Xen
24
![Page 26: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/26.jpg)
25
Figure 7.18
Use of rings of privilege
25
![Page 27: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/27.jpg)
26Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 7.19
Virtualization of memory
management
26
![Page 28: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/28.jpg)
27
Figure 7.20
Split device drivers
27
![Page 29: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/29.jpg)
28
Figure 7.21
I/O rings
28
![Page 30: Operating System Support](https://reader031.vdocuments.net/reader031/viewer/2022012508/6185379abe3e260e2c353c87/html5/thumbnails/30.jpg)
29
Figure 7.22
The XenoServer Open Platform
Architecture
29