Posts

Showing posts with the label Article

DEADLOCKS and METHODS FOR HANDLING DEADLOCKS in OS

Image
In a multiprogramming environment, several processes may compete for a finite number of resources. A process requests resources; if the resources are not available at that time, the process enters a waiting state. Coming to definition Sometimes, a waiting process is never again able to change state, because the resources it has requested are held by other waiting processes. This situation is called a deadlock. The principle of   Deadlock can be defined as the permanent blocking of a set of processes that either competes for system resources or communicate with each other. A situation in which two or more processes are unable to proceed because each is waiting For one of the others to do something. A set of processes is deadlocked (is in a deadlocked state) when each process in the set is blocked waiting for an event that can only be triggered (caused) by another blocked process in the set. All deadlocks involve conflicting needs for resources by two or more processes. Thi...

PAGE REPLACEMENT ALGORITHMS in OS

Image
PAGE REPLACEMENT ALGORITHMS In general, we want a page replacement algorithm with the lowest page-fault rate. We evaluate an algorithm by running it on a particular string of memory references and computing the number of page faults on that string. To determine the number of page faults for a particular reference string and page replacement algorithm, we also need to know the number of page frames available. Obviously, as the number of frames available increases, the number of page faults decreases. (Expected relationship between number of free frames allocated to a process and the number of page faults caused by it). FIFO Page Replacement The simplest page-replacement algorithm is a FIFO algorithm.   When a page must be replaced, the oldest page is chosen. We can create a FIFO queue to hold all pages in memory. We replace the page at the head of the queue. When a page is brought into memory we insert t at the tail of the queue.   Example: consider the reference string: 7, 0, ...
Image
BASIC ELEMENTS OF COMPUTER A computer consists of the processor, memory, and I/O components, with one or more modules of each type. These components are interconnected in some fashion to achieve the main function of the computer, which is to execute programs. Thus, there are four main structural elements: 1.       Processor: Controls the operation of the computer and performs its data processing functions. When there is only one processor, it is often referred to as the central processing unit (CPU). 2.       Main memory: Stores data and programs. This memory is typically volatile; that is when the computer is shutdown, the contents of the memory are lost. In contrast, the contents of disk memory are retained even when the computer system is shut down. Main memory is also referred to as real memory or primary memory. 3.       I/O modules: Move data between the computer and its external environment. The externa...

Cache memory

Image
Although cache memory is invisible to the OS, it interacts with other memory management hardware. Furthermore, many of the principles used in virtual memory schemes  are also applied in the cache memory. On all instruction cycles, the processor accesses memory at least once, to fetch the instruction, and often one or more additional times, to fetch operands and/ or store results. The rate at which the processor can execute instructions is clearly limited by the memory cycle time (the time it takes to read one word from or write one word to memory). This limitation has been a significant problem because of the persistent mismatch between the processor and main memory speeds: Over the years, processor speed has consistently increased more rapidly than memory access speed. We are faced with a trade-off among speed, cost, and size. Ideally, main memory should be built with the same technology as that of the processor registers, giving memory cycle times comparable to processor cycle ti...

THREADS IN OPERATING SYSTEM

Image
A thread is a basic unit of CPU utilization; it comprises a thread ID, a program counter, a register set, and a stack. It shares with other threads belonging to the same process its code section, data section, and other operating-system resources, such as open files and signals. Threads share the memory and the resources of the process to which they belong by default. Single threaded process A traditional (or heavyweight ) process has a single thread of control. when a process is running a word-processor program, a single thread of instructions is being executed. This single thread of control allows the process to perform only one task at a time. A single-threaded process has one program counter specifying the next instruction to execute. The execution of such a process must be sequential.  The CPU executes one instruction of the process after another until the process completes. multithreaded process If a process has multiple threads of control, it can perform more than one task a...

PROCESS STATE

Image
PROCESS STATE The state of a process is defined in part by the current activity of that process. As a process executes, it changes state . A process may be in one of the following states: 1.       New . The process is being created. 2.       Running . Instructions are being executed. 3.       Waiting . The process is waiting for some event to occur (such as an I/O completion or reception of a signal). 4.       Ready . The process is waiting to be assigned to a processor. 5.       Terminated . The process has finished execution. The states that they represent are found on all systems. It is important to realize that only one process can be running on any processor at any instant. Many processes may be ready and waiting, however. The state diagram corresponding to these states is presented below. Diagram of process states     SCHEDULING QUEUES Job queues A...

Dijkstra’s Algorithm

Dijkstra's algorithm   is an   algorithm   for finding the   shortest paths   between   nodes   in a   graph, which may represent, for example, road networks. It was conceived by   computer scientist   Edger W. Dijkstra   in 1956 The algorithm exists in many variants; Dijkstra's original variant found the shortest path between two nodes, but a more common variant fixes a single node as the "source" node and finds shortest paths from the source to all other nodes in the graph, producing a   shortest-path tree. For a, given source node in the graph, the algorithm finds the shortest path between that node and every other.   It can also be used for finding the shortest paths from a single node to a single destination node by stopping the algorithm once the shortest path to the destination node has been determined. For example, if the nodes of the graph represent cities and edge path costs represent driving distances between p...