Ticker

6/recent/ticker-posts

Operating system subjective question for competitive exam part1

Q1.Difference b/w binary and counting semaphore.

Binary semaphore Counting semaphore 1.Binary semaphore is semaphore 1.Counting semaphore that has multiple values of the counter.The value can range over an unrestricted domain. whose integer value range over 0 and 1. 2. typedef struct{ int semaphore_variable; queue list;}counting_semaphore; 3.The value can range 0 to N. 2.typedef struct { 4. I does not gurantees mutual exclusion. int semaphore_variable; }binary semaphore; 3. 0 means that a process is accessing the critical section other process should wait for it to exit the critical section 1 represent the critical section is free. 4. It gurantees mutual exclusion.

Q2.Why compaction is necessary and list the overheads in compaction

Soltion of external fragmentation is called compaction.Where reallocated all the processes together and reallocated all free memory together.But the compaction method is not efficient because it is very time consuming.A lot of time required to reallocate processes and free memory.Since memory space is limited we need to reuse memory and manage the free space to keep track of free space the system maintains a free space list.



Q3.What are the management function of operating system

An operating system is a piece of software that manages files,manage memory,manage processes,handle input and output and control devices like diusk drivers and printers. Memory management--The operating system manage primary memory.Primary memory is made up of large array of bytes where each byte or word is assigned a certain address.An operating system manages the allocation and deallocation of the memory to various processes and ensure that the other process does not consume the memory allocated to one process. Processor management--In a multiprogramming environment the os decides the order in which process have access to the processor and how much processing time each process has this function of os is called process scheduling. Device management--An os manage device communication via its respective drivers.Keep track of all devices connected to the system.Decide which process get access to a certain device and how long.Allocated device efficiently. File management--A file system is organized into directories for efficient or easy navigation and usage. Network management--The os provides network connectivity and manage communication b/w computer and network.It also manages network security.

Q4. Explain the concept recovery from deadlock.

Multiple processes are competing for the same shared resources.It means that each process is holding on to resources that are necessary for other process is that situation is called deadlock. Deadlock recovery Involves set of actions that are undertaken to resolve the deadlock by breaking the cycle of resource dependency b/w the processes involved in the deadlock. Process termination-os identifies ther process involved in the deadlock and terminates one or more processes.This free up the resources held by terminated processes. Resource pre-emption--os identifies the resources involved in the deadlock and select one or more resources to be pre-empted. Priority inversion--Priority of the process is changed to avoid deadlock.The process holding the required resources is given a higher priority and the process waiting for the resources is given the lower priority. Rollback--The system rollback the transaction of the involved process to a previous state where they were not deadlock.

Q5.What are the three ways in which a thread can enter the waiting state

A thread is in a waiting state when it is waiting for a specific event or a signal from another object.The thread will remain in the state until other object send the signal using notify. A thread can enter the waiting state by invoking its sleep() method,by blocking an IO,by unsuccessfully attempting to acquire an object lock or by invoking an object wait() method.It can also enter the waiting state by invoking its suspend() method.



Post a Comment

0 Comments