Showing posts with label PROCESSES AND THREADS. Show all posts
Showing posts with label PROCESSES AND THREADS. Show all posts

Sunday, December 13, 2015

banker’s algorithm



1.Define deadlock prevention.

Deadlock prevention is a set of methods for ensuring that at least one of the four necessaryconditions like mutual exclusion, hold and wait, no preemption and circular wait cannot hold. By ensuring that that at least one of these conditions cannot hold, the occurrence of a deadlock can be prevented.

2.Define deadlock avoidance.

An alternative method for avoiding deadlocks is to require additional information about how resources are to be requested.Each request requires the system consider the resources currently available, the resources currently allocated to each process, and the future requests and releases of each process, to decide whether the could be satisfied or must wait to avoid apossible future deadlock.
3.What are a safe state and an unsafe state?

A state is safe if the system can allocate resources to each process in some order and still avoid a deadlock. A system is in safe state only if there exists a safe sequence. A sequence of processes <P1,P2,....Pn> is a safe sequence for the current allocation state if, for each Pi, the resource that Pi can still request can be satisfied by the current available resource plus the resource held by all the Pj, with j<i. if no such sequence exists, then the system state is said to be unsafe.

4.What is banker’s algorithm?

Banker’s algorithm is a deadlock avoidance algorithm that is applicable to a resource-allocation system with multiple instances of each resource type.The two algorithms used for its implementation are:

a.   Safety algorithm: The algorithm for finding out whether or not a system is in a safe state.

b.     Resource-request algorithm: if the resulting resourceallocation is safe, the transaction is completed and process Pi is allocated its resources. If the new state is unsafe Pi must wait and the old resource-allocation state is restored.

5.Define logical address and physical address.

An address generated by the CPU is referred as logical address. An address seen by the memory unit that is the one loaded into the memory address register of the memory is commonly referred to as physical address.

6.What is logical address space and physical address space?

The set of all logical addresses generated by a program is called a logical address space; the set of all physical addresses corresponding to these logical addresses is a physical address space.




Thursday, December 10, 2015

multithreaded programming



1. What are the benefits of multithreaded programming?

The benefits of multithreaded programming can be broken down into four major categories:

•  Responsiveness
•  Resource sharing
•  Economy
•  Utilization of multiprocessor architectures

2.Compare user threads and kernel threads.

User threads

User threads are supported above the kernel and are implemented by a thread library at the user level. Thread creation & scheduling are done in the user space, without kernel intervention. Therefore they are fast to create and manage blocking system call will cause the entire process to block

Kernel threads

Kernel threads are supported directly by the operating system .Thread creation, scheduling and management are done by the operating system. Therefore they are slower to create & manage compared to user threads. If the thread performs a blocking system call, the kernel can schedule another thread in the application for execution.

3.What is the use of fork and exec system calls?

Fork is a system call by which a new process is created.Exec is also a system call, which is used after a fork by one of the two processes to place the process memory space with a new program.

4.Define thread cancellation & target thread.

The thread cancellation is the task of terminating a thread before it has completed. A thread that is to be cancelled is often referred to as the target thread.For example, if multiple threads are concurrently searching through a database and one thread returns the result, the remaining threads might be cancelled.

5.What are the different ways in which a thread can be cancelled?

Cancellation of a target thread may occur in two different scenarios:

•  Asynchronous cancellation: One thread immediately terminates the target thread is called asynchronous cancellation.

•   Deferred cancellation: The target thread can periodically check if it should terminate, allowing the target thread an opportunity to terminate itself in an orderly fashion.



Tuesday, December 8, 2015

CS2411 – OPEARATING SYSTEMS



1.What is an operating system?

An operating system is a program that manages the computer hardware. it act as an intermediate between a users of a computer and the computer hardware. It controls and coordinates the use of the hardware among the various application programs for the various users.

2.What is the kernel?

A more common definition is that the OS is the one program running at all times on the computer ,usually called the kernel, with all else being application programs.

3.What are batch systems?

Batch systems are quite appropriate for executing large jobs that need little interaction. The user can submit jobs and return later for the results. It is not necessary to wait while the job is processed.

4.What is graceful degradation?

In multiprocessor systems, failure of one processor will not halt the system, but only slow it down by sharing the work of failure system by other systems. This ability to continue providing service is proportional to the surviving hardware is called graceful degradation.

5.Differentiate Tightly coupled systems and loosely coupled systems?

Loosely coupled systems Tightly coupled systems Each processor has its own local memory Common memory is shared by many processors Each processor can communicate with other all through communication lines No need of any special communication lines