Deadlock

In a multi programming environment several processes may compete for a finite number of resources. A process request resources; if the resource is available at that time a process enters the wait state. Waiting process may never change its state because the resources requested are held by other waiting process. This situation is known as […]

Classical Problem on Synchronization

There are various types of problem which are proposed for synchronization scheme such as Bounded Buffer Problem: This problem was commonly used to illustrate the power of synchronization primitives. In this scheme we assumed that the pool consists of ‘N’ buffer and each capable of holding one item. The ‘mutex’ semaphore provides mutual exclusion for […]

Process Synchronization

A co-operation process is one that can affect or be affected by other processes executing in the system. Co-operating process may either directly share a logical address space or be allotted to the shared data only through files. This concurrent access is known as Process synchronization

CPU Scheduling Algorithm

CPU Scheduling deals with the problem of deciding which of the processes in the ready queue is to be allocated first to the CPU. There are four types of CPU scheduling that exist 1. First Come, First Served Scheduling (FCFS) Algorithm: This is the simplest CPU scheduling algorithm. In this scheme, the process which requests […]

Types of schedulers

There are 3 types of schedulers mainly used: 1. Long term scheduler: Long term scheduler selects process from the disk & loads them into memory for execution. It controls the degree of multi-programming i.e. no. of processes in memory. It executes less frequently than other schedulers. If the degree of multi programming is stable than […]

C and C++

Difference between break and continue statement

Break Continue can be used in switch statement cannot be used in switch statement causes premature exit of the loop causes skipping of the statements following it in the body of the loop The control is transferred to the statement of the loop control is transferred back to the loop The loop may not complete […]

Data Structures

Recursion

Recursion is the name given for expressing anything in terms of itself. A function which contains a call to itself or call to another function ,which eventually causes the first function to be called,is known as a recursive function.  Recursive procedures generally solve a given problem by reducing the problem to an instance of the […]

Data Structures

Evaluation of Postfix Expression

1.read only one input symbol at a time from postfix expression. 2.if input symbol is operand ,push operand in to stack(before pushing convert that into integer). 3.if input symbol is operator ,pop two operands from stack perform operation and push result into stack. 4.repeat the process till the expression become empty. 5.finally result will be […]

Data Structures

Convert infix expression into postfix Expression

Infix notation: In most common arithmetic opeartions,the opeartor is placed b/w the two operands. 1) A+B 2)C-D 3) E*F 4) G/H 5)(a+b)*c It is called infix notation,it can be parantheised or parantheses free expressions. Polish /Prefix notation: It is named after the polish mathematician Jan Lukasiewicz,refers to the notation in which the operator symbol is […]

Data Structures

Implement Stack by using dynamic arrays

When a stack is implemented by using static arrays the size of the stack is bound to MAXSTK(i.e maximum elements a stack can have)but some time stack need be dynamic. This can be achieved by using dynamic arrays The memory for the stack is dynamically allocated by using memory allocation functions such as malloc or […]