Middleware Services
Functions of Middleware Encapsulation Protection Concurrent processing Communication Scheduling
Core OS Components Process Manager Thread Manager Communication Manager Memory Manager Supervisor
Protection From illegitimate access –Read Or Write Protection by cryptographic techniques Another type is by FilePointer variable Protection by using a type safe language
Kernel and Protection Kernel process in supervisor mode Arranges others to be run in user mode Protection by address space Transfer between address spaces via –Interrupt –Sytem call trap Cost is extra processor cycles
Processes and threads A process may contain execution environment An Execution environment –An address space –Thread synch and communication resources –Open Files and Windows Threads can share Execution environment
Address Space Is a unit of management of a process’s virtual memory Can consists of one or more regions Each region is specified by –Its extent –Read/write/execute permissions for threads –Whether it can be grown upward or downward
Motivation for different regions Provide a stack for each thread Can detect attempts to exceed stack limits Attempt to access unallocated memory can be detected Files to be mapped into the address space
Shared regions Libraries Kernel Data sharing and communication
Creation of a new process Choice of process host –Location policy –Transfer policy Policies can be Static Deterministic Probabilistic Adaptive Apply Heuristics
Load sharing algorithm Sender initiated Receive initiated Migratory
Creation of a new Execution Environment Statically defined format –Text, stack and heap Defined with respect to an existing Execution environment –Copy on write –Page frames shared between two address spaces
Threads If a single thread can do the processing in n milli seconds a server can handle 1/ (n millisecond) client requests / second
Architecture for mutithreaded architecture Worker pool architecture Server creates a fixed pool of worker threads to process the requests when it starts up The module ‘receipt and queing’ which receives requests from a collection of sockets and places them on a shared queue for retrieval by workers
Architecture contd. Thread per request architecture Thread per connection architecture Thread per object architecture
Thread within clients Threads can be used for –Processing within Clients –And communication with remote objects in servers
Process and threads Cost of creating a new thread is less Switching Threads share data efficiently Threads within one process are not protected from one another –By type safe language
Thread programming setPrority start run sleep yeild – invoke the scheduler destroy
Thread Synchronization synchronized keyword wait notify -unblock notifyall-unblock join- block the caller until target thread’s termination interrupt – prematurely waking a waiting thread
Thread scheduling Preemptive Non preemptive Critical section yeild()
Communication Communication primitives –getRequest –sendReply –doOperation Middleware –RPC/RMI –Group communication –Event Notification
Protocols and Openness Communication between MW in different computers Amoebo RPC, VMTP, Sprite RPC Wireless –IrDA, Bluetooth Dynamic protocol composition –A protocol stack can be composed on the fly To meet reqmts of a particular appln.
Invokation performance Network bandwidth Network latencies
Invocation contd Making a system call Sending a message RPC RMI –Synchronous –Asynchronous
Invocation over the network A null RPC An RPC without parameters that executes a null procedure and return no values Little system data and no user data Total call time –Kernel action –User level RPC
Invocation costs Marshalling Data Copying Packet Initialization Thread Scheduling and Context Switching Memory Sharing Choice of protocol