Inter-Process Communication

Posted on Updated on



• Consumer sends N empty messages (i.e., slots)

• Producer picks up an empty message/slot and send back an item produced

• Consumer receives an item and sends back an empty message (i.e., a slot)

• Messages sent, but not received are buffered by OS


Naming: Direct Communication

• Sender/receiver refer to each other, as seen before

• Properties of communication link

– Link is established automatically between communicating processes

– Link is associated with exactly two processes

–Exactly one link for every pair of processes

• Communication is symmetric(above) or asymmetric

– send(P,m) // send a message to P

– receive(&id, m) // receive from any process, set id to sender

Direct Naming


Naming: Indirect Communication

• Communication via mailboxes (or ports)

• Processes communicate by putting and taking messages in/from mailboxes

–send(A, m)and receive(A,m)

• Properties of communication link

– A link is established between two processes, if they share a mailbox

– Link maybe associated with more than two processes

– A number of different links may exist between any pair of processes; each one a separate mailbox

Indirect Naming


Posted By-: Vissicomp Technology Pvt. Ltd.

Website -:

Inter-Process Communication

Posted on Updated on


It depends:

• At most one process may execute a receive operation at a time

• The system arbitrarily selects one as the receiver

• Message is retrieved by both (a form of multicast)


• Either process can own the mailbox

• OS can own it and/or creator owns it


Sender/Receiver Synchronization

• Message passing maybe blocking or non-blocking

(synchronous or asynchronous)

• Blocking send– sender blocked until message is received by receiver (or by mailbox)

• Non-blocking send– sending process resumes operation right after sending

• Blocking receive– receiver blocks until message is available

• Non-blocking receive– receiver retrieves a valid message or returns an error code

• Any combination of the above send/receive is possible

Blocking vs. non-blocking send



• The mechanism that buffers messages (a.k.a.queue) may have the following properties

–Zero capacity: queue has length 0, no messages can be outstanding on link, sender blocks for message exchange

–Bounded capacity: queue has length N, N messages can be in queue at any point in time, sender blocks if queue is full, otherwise it may continue to execute

–Unbounded capacity: queue has infinite length, sender never blocks

Message Passing in Practise

• Message Passing Interface (MPI) used in parallel programming systems

• Open MPI, a standard

• Unix’s IPC – Inter-process communication facilities

– Semaphores

– Pipes, FIFO

– Message queues


– Shared memory, memory mapped files

Characteristics of Message Passing

• Addressing

– Each process has a unique name

– Introduce the concept of a mailbox

• With sender, with receiver, with both, with OS

• Buffering

– No buffering, send blocks until receive happens or vice versa, then copy message (called a rendezvous)


• Message passing for process-to-process communication can be quite inefficient due to context switching etc.

• Copy-on-write first sets a pointer in receivers address space pointing to received data in sender’s address space

• Only if sender / receiver start writing this data will the OS copy the actual data from sender to receiver

• Otherwise, no copying of the data is performed

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -:

Inter-Process Communication

Posted on Updated on

Mutual Exclusion Based on Message Passing


Mutual Exclusion Based on Message Passing Code


send(Resource Contro, “Give me resource”);

receive(Resource Controller, Message);

// block while waiting for a reply from RC


…Critical Section…


send(Resource Controller, “Done with resource”);

Bounded Buffer Problem (no shared memory)


void consumer(void)

int item;

message m;

// initialization loop

for (i=0; i<N; i++) send(producer, &m);// N empty slots

while (TRUE) {

receive(producer, &m); // receive item


send(producer, &m); // send empty slot




void producer(void)

int item;

message m;

while (TRUE) {

item Produce_Item();

receive(consumer, &m); // empty slot

build_message(&m, item);

send(consumer, &m); // send item


Posted By-: Vissicomp Technology Pvt. Ltd.

Website -:

Inter-Process Communication

Posted on Updated on

Semaphores & Monitors

Monitors are high-level programming language concepts

– Make mutual exclusion of critical section “automatic” and therefore less error-prone

– Require compiler support

– Not widely available in modern languages (e.g., avail. In Modula 3)

– Available as an “approximation”in Java

Semaphores are more lower-level

– Require OS support

– Applications can be layered on top of them, i.e., no compiler support required

• Both concepts require some kind of shared memory

• How about synchronization problems in a distributed system (no shared memory)?

Conclusion About Monitors and Semaphores

• Monitors are high-level, but not widely supported; therefore not too useful in practice

• Semaphores are rather low-level

• None of the mechanisms discussed so far allow for information exchange between

distributed processes So we need something else!

Message Passing

•An inter-process communication mechanism

• Based on two primitives

–send (destination, &message)

• Sends a message to a destination

–receive (source, &message)

• Receives a message from a source (any source)

• System calls, not language constructs

• Blocking versions and non-blocking versions are available.

Message Passing


• Naming of sender / receiver

• Number of interacting entities

• Reliability of link

• Capacity of link

Design Issues:

Various design concerns not applicable in semaphore & monitor discussion:

• Networked system, i.e., messages may be lost (network is unreliable)

• Sender/receiver agree to use acknowledgements and retransmission timers

• Message received, but acknowledgement lost

– Receiver will get the same message twice

– Use consecutive sequence numbers

–Computer Networks


• Naming of processes for unambiguous send/receive

• Authentication, how can client know it is communicating with proper server

• Tune for performance, if sender & receiver are on the same machine (semaphore is usually cheaper)

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -:

Linux Design Principles and components of Linux system

Posted on Updated on

Design Principles

Linux is a multiuser, multitasking system with a full set of UNIX-compatible tools.

Its file system adheres to traditional UNIX semantics, and it fully implements the standard UNIX networking model.

Linux is designed to be compliant with the relevant POSIX documents; at least two Linux distributions have achieved official POSIX certification.

The Linux programming interface adheres to the SVR4 UNIX semantics, rather than to BSD behavior.

As PCs became more powerful and as memory and hard disks became cheaper, the original, minimalist Linux kernels grew to implement more UNIX functionality.

Speed and efficiency are still important design goals, but much recent and current work on Linux has concentrated on a third major design goal: standardization. One of the prices paid for the diversity of UNIX implementations currently available is that source code written for one may not necessarily compile or run correctly on another.

Even when the same system calls are present on two different UNIX systems, they do not necessarily behave in exactly the same way.

Linux is designed to be compliant with the relevant POSIX documents; at least two Linux distributions have achieved official POSIX certification.

1) Components of a Linux System

The Linux system has three main bodies of code, in sequence with, most conventional UNIX implementations.

1- THE KERNEL: “The kernel” is in charge for maintaining all the vital abstractions of the operating system, together with such things as virtual memory and processes. The Linux kernel forms the central part of Linux operating system. It provides all the functionality compulsory to run processes, and it also provides “system services” to give arbitrated and sheltered or protected access to hardware resources. The kernel implements every feature that is required to be eligible as an operating system.

1- THE SYSTEM LIBRARIES: “the system libraries” describe a typical set of functions through which applications can interrelate through the kernel. And which apply much of the operating system functionality that does not require the full rights or privileges of kernel code.

2- THE SYSTEM UTILITIES: “the system utilities” are the programs that execute individual, particular and specialized managing tasks.

some of the system utilities may be invoked just once to initialize and configure some features of the system; others (known as daemons in UNIX language ) may run enduringly, conducting such tasks as responding to inward or incoming network connections, accepting logon requests terminals or updating log records and files.

The whole kernel code executes in the privileged mode of processor along with the full access to all the physical resources of the computer. This privileged mode in Linux is referred as “kernel mode”, equal to the monitor mode.

In Linux user-mode code is not built into the kernel. Any operating-system-support code that does not require to execute in kernel mode is located into the system libraries as an alternative.

Because all kernel code and data structures are kept in a single address space, no context switches are necessary when a process calls an operating-system function or when a hardware interrupt is delivered.


Fig: Components of the Linux system.

This single address space contains not only the core scheduling and virtual memory code but all kernel code, including all device drivers, file systems, and networking code.

Even though all the kernel components share this same melting pot, there is still room for modularity.

The Linux kernel forms the core of the Linux operating system.

The system libraries provide many types of functionality. At the simplest level, they allow applications to make kernel-system service requests. Making a system call involves transferring control from unprivileged user mode to privileged kernel mode; the details of this transfer vary from architecture to architecture. The libraries take care of collecting the system-call arguments and, if necessary, arranging those arguments in the special form necessary to make the system call.

The libraries may also provide more complex versions of the basic system calls. For example, the C language’s buffered file-handling functions are all implemented in the system libraries, providing more advanced control of file I/ 0 than the basic kernel system calls.

The LINUX system includes a wide variety of user-mode programs-both system utilities and user utilities.

The system utilities include all the programs necessary to initialize the system, such as those to configure network devices and to load kernel modules. Continually running server programs also count as system utilities; such programs handle user login requests, incoming network connections, and the printer queues.

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -:

Fundamental of Operating system

Posted on Updated on

Functions of Operating System:

Operating system performs three functions:

1. Convenience: An OS makes a computer more convenient to use.

2. Efficiency: An OS allows the computer system resources to be used in an efficient manner.

3. Ability to Evolve: An OS should be constructed in such a way as to permit the effective development, testing and introduction of new system functions without at the same time interfering with service.


Operating systems have been evolving through the years. Following table shows the history of OS.



 An operating system provides services to programs and to the users of those programs. It provided by one environment for the execution of programs. The services provided by one operating system is difficult than other operating system.

Operating system makes the programming task easier.

The common service provided by the operating system is listed below.

1. Program execution

2. I/O operation

3. File system manipulation

4. Communications

5. Error detection

1. Program execution: Operating system loads a program into memory and executes the program. The program must be able to end its execution, either normally or abnormally.

2. I/O Operation : I/O means any file or any specific I/O device. Program may require any I/O device while running. So operating system must provide the required I/O.

3. File system manipulation : Program needs to read a file or write a file. The operating system gives the permission to the program for operation on file.

4. Communication : Data transfer between two processes is required for some time. The both processes are on the one computer or on different computer but connected through computer network. Communication may be implemented by two methods:

a. Shared memory

b. Message passing.

5. Error detection : error may occur in CPU, in I/O devices or in the memory hardware. The operating system constantly needs to be aware of possible errors. It should take the appropriate action to ensure correct and consistent computing.

Operating system with multiple users provides following services.

1. Resource Allocation

2. Accounting

3. Protection

A) Resource Allocation :

If there are more than one user or jobs running at the same time, then resources must be allocated to each of them.

Operating system manages different types of resources require special allocation code, i.e. main memory, CPU cycles and file storage.

There are some resources which require only general request and release code. For allocating CPU, CPU scheduling algorithms are used for better utilization of CPU.

CPU scheduling algorithms are used for better utilization of CPU. CPU scheduling routines consider the speed of the CPU, number of available registers and other required factors.

B) Accounting :

Logs of each user must be kept. It is also necessary to keep record of which user how much and what kinds of computer resources. This log is used for accounting purposes.

The accounting data may be used for statistics or for the billing. It also used to improve system efficiency.

C) Protection :

Protection involves ensuring that all access to system resources is controlled. Security starts with each user having to authenticate to the system, usually by means of a password. External I/O devices must be also protected from invalid access attempts.

In protection, all the access to the resources is controlled. In multiprocessor environment, it is possible that, one process to interface with the other, or with the operating system, so protection is required.

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -:


Posted on Updated on


Advantages of Database Systems –

The DBMS (Database Management System) is preferred ever the conventional file processing system due to the following


1. Controlling Data Redundancy

In the conventional file processing system, every user group maintains its own files for handling its data files. This may lead to

• Duplication of same data in different files.

• Wastage of storage space, since duplicated data is stored.

• Errors may be generated due to updation of the same data in different files.

• Time in entering data again and again is wasted.

• Computer Resources are needlessly used.

• It is very difficult to combine information.

2. Elimination of Inconsistency

In the file processing system information is duplicated throughout the system. So changes made in one file may be necessary be carried over to another file. This may lead to inconsistent data. So we need to remove this duplication of data in multiple file to eliminate inconsistency.

To avoid the above problem, there is a need to have a centralize database in order to have this conflicting information.

On centralizing the data base the duplication will be controlled and hence inconsistency will be removed.

3. Better service to the users

A DBMS is often used to provide better services to the users. In conventional system, availability of information is often poor, since it normally difficult to obtain information in a timely manner because our existing systems are not capable to produce the same.

Once several conventional systems are combined to form one centralized database, the availability of information and its updateness is likely to improve since the data can now be shared and DBMS makes it easy to respond to anticipated information requests.

Centralizing the data in the database also means that user can obtain new and combined information easily that would have been impossible to obtain otherwise.

Also use of DBMS should allow users that don’t know programming to interact with the data more easily, unlike file processing system where the programmer may need to write new programs to meet every new demand.

4. Flexibility of the System is Improved

Since changes are often necessary to the contents of the data stored in any system, these changes are made more easily in a centralized database than in a conventional system.

Applications programs need not to be changed on changing the data in the database.

5. Integrity can be improved

Since data of the organization using database approach is centralized and would be used by a number of users at a time, it is essential to enforce integrity-constraints.

In the conventional systems because the data is duplicated in multiple files so updating or changes may sometimes lead to entry of incorrect data in some files wherever it is applicable.

Even if we centralized the database it may still contain incorrect data. For example: -• Salary of full time clerk may be entered as Rs. 1500 rather than Rs. 4500.

A student may be shown to have borrowed library books but has no enrollment.

The above problems can be avoided by defining the validation procedures whenever any update operation is attempted.

6. Standards can be enforced

Standards are easier to enforce in database systems because all the data in database is access through centralized DBMS.

Here standards may relate to the naming of data, structure of data, format of the data etc.

Standardizing stored data formats is usually desirable for the purpose of data interchange or migration between systems.

7. Security can be improved

In conventional systems, applications are developed in an adhoc manner.

Often different system of an organization would access different components of the operational data, in such an environment enforcing security can be quiet difficult.

Setting up of a database makes it easier to enforce security restrictions since data is now centralized.

It is easier to control who has access to what parts of the database. Different checks can be established for each type of access (retrieve, modify, delete etc.) to each piece of information in the database.

8. Organization’s requirement can be easily identified

All organizations have sections and departments and each of these units often consider the work of their unit as the most important and therefore consider their need as the most important.

Once a database has been setup with centralized control, it will be necessary to identify organization’s requirement and to balance the needs of the competition units.

So it may become necessary to ignore some requests for information if they conflict with higher priority need of the organization.

9. Data Model must be developed

Perhaps the most important advantage of setting up of database system is the requirement that an overall data model for an organization be build. In conventional systems, it is more likely that files will be designed as per need of particular applications demand.

The overall view is often not considered. Building an overall view of an organization’s data is usual cost effective in the long terms.

10. Provides backup and Recovery

Centralizing a database provides the schemes such as recovery and backups from the failures including disk crash, power failures, software errors which may help the database

to recover from the inconsistent state to the state that existed prior to the occurrence of the failure, though methods are very complex.

Disadvantages of Database Systems

The following are the disadvantages of Database Systems

1. Database Complexity

The design of the database system is complex, difficult and is very time consuming task to perform.

2. Substantial hardware and software start-up costs Huge amount of investment is needed to setup the required hardware and the softwares needed to run those applications.

3. Damage to database affects virtually all applications programs If one part of the database is corrupted or damaged because of the hardware or software failure, since we don’t have many versions of the file, all the application programs which are dependent on this database are implicitly affected.

4. Extensive conversion costs in moving form a file-based system to a database system If you are currently working on file based system and need to upgrade it to database system, then large amount of cost is incurred in purchasing different tools, adopting different techniques as per the requirement.

5. Initial training required for all programmers and user. Large amount of human efforts, the time and cost is needed to train the end users and application programmers in order to get used to the database systems.

Posted By-: Vissicomp Technology Pvt. Ltd.

Website -: