Posts

PROCESS SYNCHRONIZATION and RACE CONDITION

Image
·          Process synchronization   refers to the idea that multiple   processes   are to join up or handshake at a certain point, in order to reach an agreement or commit to a certain sequence of action. (to meet in such a way to reach the processes to completion, not to reach to deadlock) ·          Process Synchronization means sharing system resources by processes in such a way that, Concurrent access to shared data is handled thereby minimizing the chance of inconsistent data.  ·          Process Synchronization was introduced to handle problems that arose while multiple process executions. Some of the problems are: 1.       Critical problem 2.       Synchronization hardware 3.       Mutex locks 4.       Semaphores RACE CONDITION A ...

Polymorphism

Image
Polymorphism is a feature of OOP that allows one interface to be used for a general class of actions. The specific action is determined by the exact nature of the situation. By dint of polymorphism, it is possible to design a generic interface to a group of related activities. This helps reduce complexity by allowing the same interface to be used to specify a general class of action. It is the compiler’s job to select the specific action as it applies to each situation. The programmer does not need to make the selection manually. He needs only remember and utilize the general interface. In this way, polymorphism promotes extensibility.

Features of object-oriented programming over the procedure-oriented and Java as platform independence

Image
Java makes platform independence possible by translating a program into bytecode instead of machine code. Bytecode is a highly optimized set of instructions designed to be executed by the Java run-time system or JVM (Java Virtual Machine). Translating a Java program into bytecode makes it much easier to run a program in a wide variety of environments because only the JVM needs to be implemented for each platform. Once the run-time package exists for a given system, any Java program can run on it. Although the details of the JVM will differ from platform to platform, all understand the same Java bytecode. If a Java program were compiled to native code, then different versions of the same program would have to exist for each type of CPU. Thus, the execution of bytecode by the JVM is the easiest way to create truly portable programs.

There are three principles of OOP short definations

Image
Encapsulation Inheritance Polymorphism Encapsulation is the mechanism that binds together code and the data it manipulates and keeps both safe from outside interference and misuse.  Inheritance is the process by which one object acquires the properties of another object. By use of inheritance, an object would need only to define those qualities that make it unique within its class. It can inherit its general attributes from its parent. Thus, it is the inheritance mechanism that makes it possible for one object to be a specific instance of a more general case. Polymorphism is a feature that allows one interface to be used for a general class of actions. The specific action is determined by the exact nature of the situation.

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...