Download Operating System Support

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

Distributed operating system wikipedia , lookup

Transcript
OPERATING SYSTEM
SUPPORT
DISTRIBUTED SYSTEMS
CHAPTER 6
Lawrence Heyman
July 8, 2002
CONTENTS
1.
2.
3.
4.
5.
6.
7.
INTRODUCTION
THE OPERATING SYSTEM LAYER
PROTECTION
PROCESSES AND THREADS
COMMUNICATION AND INVOCATION
OPERATING SYSTEM ARCHITECTURE
SUMMARY
OPERATING SYSTEM SUPPORT
• Important aspect of DS is resource sharing
• Client applications invoke operations
• Middleware provides remote invocations
between processes at nodes of DS
• OS is layer below middleware
• OS supports middleware at nodes of a DS
– encapsulation
– protection
– invocation
TASK OF OS
• Provide abstraction of physical resources
–
–
–
–
Processors
Memory
Communications
Storage media
• System call interface
– Files rather than data blocks
– Sockets rather than raw network access
NETWORK OS vs DISTRIBUTED OS
• Multiple system
images
• Autonomous nodes
• Remote login
• Single system image
• Not autonomous
– rlogin & telnet
• Control at own node
• User scheduling
• OS controls all nodes
• Transparent access
REASONS AGAINST DS
• Investment in current application software
• Preference for autonomy
• Combination of Middleware and Network
offers balance
WHAT DOES OS PROVIDE?
• OS running at a node provides abstractions
of local hardware resourse
• Middleware uses these resources for
remote invocations at the nodes
• Kernel and server processes manage
resources and provide client interface
• Clients access resources
PROTECTION
• Problems
– malicious code, bugs
– unanticipated behavior
– illegitimate access
• Solutions
– use of type-safe language
– hardware support at kernel level
• Price is speed
OS COMPONENTS
•
•
•
•
•
Process manager
Thread manager
Communications manager
Memory manager
Supervisor
PROCESSES & THREADS
• Process
– an execution environment with one or more threads
• Execution Environment
– unit of resource management
• local kernel-managed resources
• to which threads have access
– the protected domain in which threads exe
• Thread
– the OS abstraction of an activity
PROCESS CREATION
• Creation of execution environment
– Address space
– Initialized contents
• Transparent to user
• Choice of target host node is policy decision
–
–
–
–
–
transfer policy
location policy
sender-initiated
receiver-initiated
migration
ADVANTAGES OF THREADS
•
•
•
•
•
dynamically created and destroyed
maximize concurrent execution
maximize throughput (rps)
overlap of computation with input/output
concurrent processing on multiprocessors
– reduces bottlenecks
MULTI-THREAD SERVER
ARCHITECTURES
1.
2.
3.
4.
Worker-pool
Thread-per-request
Thread-per-connection
Thread-per-object
( Various hybrids also possible )
WORKER-POOL
i/o
THREAD-PER-REQUEST
THREAD-PER-CONNECTION
THREAD-PER-OBJECT
THREADS vs MULTIPLE PROCESSES
1. Switching to different thread within process
cheaper than switching to thread in 2nd process
2. Threads within process may share resources
and data efficiently compared to separate
processes
3. Creating new thread within process is cheaper
than creating new process
4. Threads within a process not protected from
one another
THREADS PROGRAMMING
• Threads programming is concurrent
– C - threads library
– Java – methods
• Threads Lifetimes
–
–
–
–
New thread created in SUSPENDED state
Made RUNNABLE with start()
Executes on run() method
Ends on return from run() or destroy()
• Threads groups
– Assigned at creation
– Security
THREADS PROGRAMMING #2
• Threads Synchronization
– Local variables are private (private stack)
– Synchronized through monitor construct so
only one thread can execute at a time
• in Queue class
• in Object class
• Threads Scheduling
– Preemptive
– Non-preemptive
THREADS PROGRAMMING #3
• Threads Implementation
– Many kernel-level implementations (NT,
Solaris) are multi-level
– Creation and management system calls
– Schedule threads individually
– Threads run-time library
• Organizes multi-threaded processes
• Linked to user-level applications
• Kernel not involved here
THREADS PROGRAMMING #4
• User-level threads
– Advantages over kernel-level threads
– Disadvantages without kernel support
• Combining user-level and kernel-level
enables user-level code provide
scheduling hints to kernel’s thread
scheduler
– Advantages
– Disadvantage
HIERARCHAL
EVENT-LEVEL SCHEDULING
• User-level scheduler requires kernel to
notify it of scheduling-relevant events
• Each application process contains userlevel scheduler
– manages threads in that process
• Kernel allocates virtual processors
– application requirements
– priority
– total demand
ASSIGNMENT
OF VIRTUAL PROCESSORS
PROCESS
A
PROCESS
B
KERNEL
TYPES OF EVENTS
• Scheduler Activation call from kernel notifies
process scheduler of an event
–
–
–
–
Virtual Processor Added (ready thread)
SA blocked
SA unblocked
SA preempted
• Advantages
– allocation based on user-level priorities
– kernel does not influence user-level scheduler’s
behavior
EVENTS SCHEDULING
PROCESS
P ADDED
SA PREEMPTED
SA UNBLOCKED
SA BLOCKED
P IDLE
P NEEDED
KERNEL
SUMMARY
• OS Support of middleware
– Implementing of resource management policy
– Encapsulation and protection of resources
– Allows concurrent sharing of resources
• Processes
– Execution environment
• Address space
• Communication interfaces
• Local resources, i.e., semaphores
– Threads – kernel-level & user-level
• Share the execution environment
• Cheap concurrency
• Parallel multiprocessors
THE END