SEMAPHORES
In programming, especially in UNIXsystems, semaphores are a technique for coordinating or synchronizing activities in which multiple process compete for the same operating system resources. A semaphore is a value in a designated place in operating system (or kernel) storage that each process can check and then change. Depending on the value that is found, the process can use the resource or will find that it is already in use and must wait for some period before trying again. Semaphores can be binary(0 or 1) or can have additional values. Typically, a process using semaphores checks the value and then, if it using the resource, changes the value to reflect this so that subsequent semaphore users will know to wait.
Semaphores are commonly use for two purposes: to share a common memory space and to share access to files. Semaphores are one of the techniques for interprocess communication (IPC). The C programming language provides a set of interfaces or “functions” for managing semaphores.
INTERPROCESS COMMUNICATION
interprocess communication (IPC) is a set of programming interfaces that allow a programmer to coordinate activities among different program processs es that can run concurrently in an operating system.. This allows a program to handle many user requests at the same time. Since even a single user request may result in multiple processes running in the operating system on the user’s behalf, the processes need to communicate with each other. The IPC interfaces make this possible. Each IPC method has its own advantages and limitations so it is not unusual for a single program to use all of the IPC methods.
MESSAGE PASSING
Transmitting a message from one computer to another or transferring a message within the computer from one application to another or from the operating system to an application.
message passing – One of the two techniques for communicating between parallel processes .
A common use of message passing is for communication in a parallel computer. A process running on one processor may send a message to a process running on the same processor or another. The actual transmission of the message is usually handled by the run-time support of the language in which the processes are written, or by the operating system.
NOTE: If u have any query related to these topics please email us:
shwethachams@gmail.com
rajeshbit06@gmail.com
NOTE
“Message passing scales better than shared memory, which is generally used in computers with relatively few processors. This is because the total communications bandwidth usually increases with the number of processors.”
A message passing system provides primitives for sending and receiving messages. These primitives may by either synchronous or asynchronous or both. A synchronous send will not complete (will not allow the sender to proceed) until the receiving process has received the message. This allows the sender to know whether the message was received successfully or not (like when you speak to someone on the telephone). An asynchronous send simply queues the message for transmission without waiting for it to be received (like posting a letter). A synchronous receive primitive will wait until there is a message to read whereas an asynchronous receive will return immediately, either with a message or to say that no message has arrived.
Messages may be sent to a named process or to a named mailbox which may be readable by one or many processes.
Transmission involves determining the location of the recipient and then choosing a route to reach that location. The message may be transmitted in one go or may be split into packets which are transmitted independently (e.g. using wormhole routing) and reassembled at the receiver. The message passing system must ensure that sufficient memory is available to buffer the message at its destination and at intermediate nodes.
Some message passing computers are the MIT J-Machine, the Illinois Concert Projecct and transputer-based systems.
SHARED MEMORY
Shared Memory is an efficeint means of passing data between programs. One program will create a memory portion which other processes (if permitted) can access.
REAL TIME OPERATING SYSTEM AND THEIR TYPES
A real-time operating system (RTOS) is an O.S that guarantees a certain capability within a specified time constraint. For example, an operating system might be designed to ensure that a certain object was available for a robot on an assembly line. In what is usually called a “hard” real-time operating system, if the calculation could not be performed for making the object available at the designated time, the operating system would terminate with a failure. In a “soft” real-time operating system, the assembly line would continue to function but the production output might be lower as objects failed to appear at their designated time, causing the robot to be temporarily unprod
FRAGMENTATION
Fragmentation is caused when an operating system breaks a file into pieces because there is not enough space on the storage device where the file was originally saved.
One example of this would be where a file was originally saved, then modified causing the file to be larger in physical space than first anticipated, the operating system will then break the file into 2 or more pieces and store them in different parts of the storage area.
The system would then keep a record of where the different parts of the file are stored, this is achieved through the use of a File Allocation Table (FAT)or similar file system such as NTFS.
Then, when the operating system requires the file again, it will query the file system (FAT/NTFS/or others to find out where the different parts of the file are located on the partition (drive).
Defragmentation is the term given to the process of scanning the file system and rejoining the split files back into consecutive pieces.
NOTE: The process of defragmenting can be time consuming, but it is one of the easiest ways to increase the performance of your PC, the frequency of which a PC should be defragmented will directly depend on the amount of usage.
EXTERNAL FRAGEMENTATION
Fragmentation arise due to inefficient use of memory or due to the memory management algorithm.
Talking about latest techniques that is used by the present operating system.main memory of a computer is divided in to small section called frames.When a program is loaded on themain memory(not taking paging in account) a particular no of frames is used. When a program terminate it free the memory between two process(suppose) now if the program to be loaded is not of the same length as the earlier program then some frames will remain unasigned. These frames keep increasing when more no of processes enter or exit from main memory.
This division of free memory in small pieces is called External fragmentation.
INTERNAL FRAGEMENTATION
Partition suffer from inefficient memory use-any process,no matter how small,occupies on entire portion.This waste of memory is called Internal fragmentation.
MULTIPROGRAMMING ,MULTITASKING AND MULTITREADTING
Multi programming: Multiprogramming is the technique of running several programs at a time using timesharing. It allows a computer to do several things at the same time. Multiprogramming creates logical parallelism. The concept of multiprogramming is that the operating system keeps several jobs in memory simultaneously. The operating system selects a job from the job pool and starts executing a job, when that job needs to wait for any i/o operations the CPU is switched to another job. So the main idea here is that the CPU is never idle.
Multi tasking: Multitasking is the logical extension of multiprogramming .The concept of multitasking is quite similar to multiprogramming but difference is that the switching between jobs occurs so frequently that the users can interact with each program while it is running. This concept is also known as time-sharing systems. A time-shared operating system uses CPU scheduling and multiprogramming to provide each user with a small portion of time-shared system.
Multi threading: An application typically is implemented as a separate process with several threads of control. In some situations a single application may be required to perform several similar tasks for example a web server accepts client requests for web pages, images, sound, and so forth. A busy web server may have several of clients concurrently accessing it. If the web server ran as a traditional single-threaded process, it would be able to service only one client at a time. The amount of time that a client might have to wait for its request to be serviced could be enormous. So it is efficient to have one process that contains multiple threads to serve the same purpose. This approach would multithread the web-server process, the server would create a separate thread that would listen for client requests when a request was made rather than creating another process it would create another thread to service the request. To get the advantages like responsiveness, Resource sharing economy and utilization of multiprocessor architectures multithreading concept can be used.
SCHEDULER
Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. CPU scheduling decisions may take place when a process: 1.Switches from running to waiting state. 2.Switches from running to ready state. 3.Switches from waiting to ready. 4.Terminates. Scheduling under 1 and 4 is non-preemptive. All other scheduling is preemptive.
TYPES OF SCHEDULERS
PAGING
Paging is solution to external fragmentation problem which is to permit the logical address space of a process to be noncontiguous, thus allowing a process to be allocating physical memory wherever the latter is available.
CACHE MEMORY
Cache memory is random access memory (RAM) that a computer microprocessor can access more quickly than it can access regular RAM. As the microprocessor processes data, it looks first in the cache memory and if it finds the data there (from a previous reading of data), it does not have to do the more time-consuming reading of data from larger memory.
CONTEXT SWITCHING
Switching the CPU to another process requires saving the state of the old process and loading the saved state for the new process. This task is known as a context switch. Context-switch time is pure overhead, because the system does no useful work while switching. Its speed varies from machine to machine, depending on the memory speed, the number of registers which must be copied, the existed of special instructions(such as a single instruction to load or store all registers).
DISPATCHER
Dispatcher module gives control of the CPU to the process selected by the short-term scheduler; this involves: Switching context, Switching to user mode, Jumping to the proper location in the user program to restart that program, dispatch latency – time it takes for the dispatcher to stop one process and start another running.
READER WRITER PROBLEM
The problem consists of readers and writers that share a data resource. The readers only want to read from the resource, the writers want to write to it. Obviously, there is no problem if two or more readers access the resource simultaneously. However, if a writer and a reader or two writers access the resource simultaneously, the result becomes indeterminable. Therefore the writers must have exclusive access to the resource.
DEADLOCK
deadlock is a situation in which two computer programs sharing the same resource are effectively preventing each other from accessing the resource, resulting in both programs ceasing to function.
Program 1 requests resource A and receives it.
Program 2 requests resource B and receives it.
Program 1 requests resource B and is queued up, pending the release of B.
Program 2 requests resource A and is queued up, pending the release of A.
Now neither program can proceed until the other program releases a resource. The operating system cannot know what action to take. At this point the only alternative is to abort (stop) one of the programs
STARVATION
Starvation is a resource mgt problem where a process does not get the resources it needs for a long time because the resources are being allocated to other process.
AGING
Aging is a technique to avoid starvation in a scheduling system. It works by adding an aging factor to the priority of each request. The aging factor must increase the request’s priority as time passes and must ensure that a request will eventually be the highest priority request (after it has waited long enough)
if u have any query related to these please email us:
shwethachams@gmail.com
rajeshbit06@gmail.com