Aos Unit-IV Notes
Aos Unit-IV Notes
Multiprocessor System Architectures: Introduction, Motivation for multiprocessor Systems, Basic Multiprocessor System
Architectures Multi Processor Operating Systems: Introduction, Structures of Multiprocessor Operating Systems, Operating
Design Issues, Threads, Process Synchronization, Processor Scheduling.
Distributed File Systems: Architecture, Mechanisms for Building Distributed File Systems, Design Issues
1. Multiprocessor system
Definition: A system with two or more processors (CPUs) within a single computer system is
called as multiprocessor system. The main memory (RAM) is shared by all the processors in this
system.
The main feature of this architecture is to provide high speed at low cost. These types of
systems are used when very high speed is required to process a large volume of data. These
systems are generally used in environment like satellite control, weather forecasting, etc.
Based on location of main memory and its accessibility with respect to processors,
Multiprocessor systems are classified into three types. They are:
Uniform memory access (UMA) system
Non-Uniform memory access (NUMA) system
No Remote Memory Access (NORMA) system
Processor Processor
Processor Processor
Memory Memory
Master-Slave configuration
In master-slave configuration, one processor behaves as a master whereas others behave
as slaves.
The operating system is executed by only master processor and the slave processors
execute application programs.
The master processor schedules the work and assigns to slave processors.
Since the operating system is executed by only single processor, it is efficient and its
implementation (synchronization of shared variables, etc) is easy.
This arrangement allows the parallel execution of a single task. The single task is divided
into subtasks and allocating these subtasks to multiple processors to execute
concurrently.
The main limitation of this system is the failure of master processor. When master
processor fails, then slave processors cannot be utilized.
Examples of such operating systems are Cyber-170 and DEC-10.
A thread is also called a lightweight process. A process can be divided into multiple
threads. Threads represent a software approach to improving performance of operating system by
reducing the context switching overhead. Each thread belongs to exactly one process and no
thread can exist outside a process. Each thread represents a separate flow of control. The
following figure shows the working of a single-threaded and a multithreaded process.
Figure: Single process P with single thread Single process P with 3 threads
To overcome the problems associated with user-level threads, three mechanisms are provided
to communicate between the kernel and the thread package. These communications occur
without any kernel traps. These mechanisms are as follows:
(i). The kernel and the thread package share important data structures.
(ii). The kernel provides the thread package with software interrupts (signals, upcalls)
whenever a scheduling decision is required.
(iii). Scheduler interfaces are provided to enable the sharing of data abstractions between
dissimilar thread packages.
Scheduler Activations
Scheduler Activation is a mechanism that enables user-level threads to have complete
control over scheduling policy. It provides kernel-level thread functionality with user-level
thread flexibility and performance.
6. Process Synchronization
Process Synchronization is a mechanism that handles concurrent access to shared
resources by processes without any inconsistencies.
The test-and-set instruction atomically reads and modifies the contents of a memory location in
one memory cycle. It is defined as follows (variable m is a memory location):
The Test_and_Set instruction returns the current value of variable m and sets it to true. This
instruction can be used to implement P and V operations on a binary semaphore, S, in the
following way (S is implemented as a memory location):
Initially, S is set to false. When a P(S) operation is executed for the first time, Test-and-Set(S)
returns a false value (and sets S to true) and the “while” loop of the P(S) operation terminates.
All subsequent executions of P(S) keep looping because S is true until a V(S) operation is
executed.
P and V operations can be implemented using the swap instruction in the following way (P is a
variable private to the processor and S is a memory location):
The above two implementations of the P operation employ busy-waiting and therefore increase
the traffic on the interconnection network. Another problem with test-and-set and swap
instructions is that if n processors execute any of these operations on the same memory location,
the main memory will perform n such operations on the location even though only one of these
operations will succeed.
The fetch-and-add instruction is powerful and it allows the implementation of P and V operations
on a general semaphore, S, in the following manner:
The outer “while-do” statement ensures that only one processor succeeds in decrementing S to 0
when multiple processors try to decrement variable S. All the unsuccessful processors add 1 back
to S and again try to decrement it. The second “while-do” statement forces an unsuccessful
processor to wait (before retrying) until S is greater than 0.
Busy Waiting: In busy-waiting, processors continuously execute the atomic instruction to check
for the status of the shared variable. It (also called spin lock) wastes processor cycles and
degrade the system performance.
Queueing: In queueing, a process waiting for a semaphore is placed in a global queue. A waiting
process is dequeued and activated by a V operation on the semaphore. Although queueing
eliminates network traffic and the wastage of processor cycles due to busy-waiting, it introduces
other processing overhead because the enqueue and the dequeue operations require the execution
of several instructions. Also, the queue forms a shared data structure and must be protected
against concurrent access.
When the client device retrieves a file from the server, the file appears as a normal file
on the client machine, and the user is able to work with the file in the same ways as if it were
stored locally on the workstation. When the user finishes working with the file, it is returned over
the network to the server, which stores the now-altered file for retrieval at a later time.
A request by a process to access a data block is checked in the local cache (client cache) of the
machine (client) on which the process is running. If the block is not in the cache, then the local
disk is checked for the presence of the data block. If the block is present, then the request is
satisfied and the block is loaded into the client cache. If the block is not stored locally, then the
request is passed on to the appropriate file server (as per the name server). The server checks its
own cache for the presence of the data block before issuing a disk I/O request. The data block is
transferred to the client cache in any case and loaded to the server cache if it was missing in the
server cache.
(i). Mounting: Mount mechanisms allow the binding of different file namespaces to form a
single hierarchical namespace. In distributed system, when a remote file needs to be
accessed, a special entry known as a mount point is created at some position in the local file
namespace to bind the root of remote file name space. This mechanism is mostly used by
UNIX operating system.
(ii). Client Caching: Caching is to reduce delays in the accessing of data. In file caching, a copy
of data stored at a remote file server is brought to the client, when first time the file is
referenced by the client. Subsequent access to the same file data is performed locally at the
client, thereby reducing access delays due to network latency. Data can either be cached in
the main memory or on the local disk of the clients. Similarly, data is also cached in the
main memory (server cache) at the servers to reduce disk access latency.
(iii). Hints: Caching is an important mechanism to improve the performance of a file system;
however, the consistency of the cached items requires expensive client/server protocols.
When the cached data treated as hints, then cached data may not be completely accurate. But
when applications use the invalid cached data, hints make them to recover. For example,
after the name of a file is mapped to an address, that address is stored as a hint in the cache.
If the address later fails, it is purged from the cache. The name server is consulted to provide
the actual location of the file and the cache is updated.
(iv). Bulk Data Transfer: The data transfer in a network requires the execution of various
communication layer protocols. Data is assembled and disassembled into packets; packets
copied between the buffers of various layers, transmitted and acknowledged over the
network. For small amounts of data, the transit time is low, but, network latency is high due
to establishing peer connections, packets transmission and acknowledging each packet.
Transferring data in bulk reduces the relative cost of this overhead at the source and
destination. With this scheme, multiple consecutive data packets are transferred from
(v). Encryption: A number of possible threats exist such as unauthorized access of information,
unauthorized modification of information, or unauthorized denial of resources. Encryption is
used for enforcing security in distributed systems. Encryption converts the original text into
secret code text.
(i). Naming and name resolution: A name is associated with every object such as a file or
directory. Name resolution refers to mapping a name to an object. There are three
approaches to name files in a distributed environment. They are: The first approach is to
concatenate the host name to the file name. It guarantee unique file name and does not need
any name resolution. The problem with this approach is that moving a file from one host to
another requires changes in the filename. The second approach is to mount remote
directories onto local directories. Once mounted, accessing the file becomes location
transparent and name resolution is simple. The third approach is to use single global
directory where all the files in the system belong to a single name space.
(ii). Caches on Disk or Main Memory: Caching is to reduce delays in the accessing of data. In
file caching, a copy of data stored at a remote file server is brought to the client, when first
time the file is referenced by the client. Subsequent access to the same file data is
performed locally at the client, thereby reducing access delays due to network latency. Data
can either be cached in the main memory or on the local disk of the clients. Accessing a
cache in main memory is much faster than accessing a cache on local disk.
(iii). Writing Policy: The writing policy decides when a modified cache block at a client should
be transferred to the server. The simplest policy is write-through. In write-through, all
modifications done by the applications at clients are also carried out at the servers
immediately. The main advantage of write-through is reliability. In the event of a client
crash, little information is lost. A write-through policy, however, does not take advantage
of the cache. An alternate writing policy is delayed writing policy. In delayed writing,
modifications done by applications at client are reflected at the server after some delay. The
problem with this is, in the event of a client crash, a significant amount of data can be lost.
(iv). Cache Consistency: The Cache Coherence Problem is the challenge of keeping multiple
local caches synchronized when one of the processors updates its local copy of data which
is shared among multiple caches. There are two approaches to guarantee that the cache data
is consistent.
(v). Availability: Availability is one of the important issues in the design of distributed file
systems. The failure of servers or the communication network can severely affect the
availability of files. Replication is the primary mechanism used for enhancing the
availability of files in distributed file systems. Under replication, many copies or replicas of
files are maintained at different servers. Replication is inherently expensive because of the
extra storage space required to store the replicas and the overhead incurred in maintaining
all the replicas up to date. The most serious problems with replication are (I) how to keep
the replicas of a file consistent and (2) how to detect inconsistencies among replicas of a
file and subsequently recover from these inconsistencies.
(vi). Scalability: The issue of scalability deals with the suitability of the design of a system to
cater to the demands of a growing system. Currently, client-server organization is a
commonly used approach to structure distributed file systems. Caching, which reduces
network latency and server-load is the primary technique used in client-server organization
to improve the client response time. Caching, however, introduces the cache consistency
problem. The solution to cache consistency is discussed in the above section.
(vii). Semantics: The semantics of a file system says a read operation of a data will return the
latest write (updated) operation of that data. In distributed file systems, guaranteeing the
above semantics is difficult and expensive due to usage of cache. One solution is to allow
all the reads and writes from various clients will have to go through the server. The server
can potentially become a bottleneck and the overheads are high because of high traffic
between the server and the clients.