Showing posts with label OS. Show all posts
Showing posts with label OS. Show all posts

Thursday, December 17, 2015

I/O SYSTEMS



1.What are the allocation methods of a disk space?
Methods of allocating disk space which are widely in use are
a.  Contiguous allocation
b.  Linked allocation
c.  Indexed allocation

2.What are the advantages of Contiguous allocation?

The advantages are
a.  Supports direct access
b.  Supports sequential access
c.  Number of disk seeks is minimal.

3.What are the drawbacks of contiguous allocation of disk space?

The disadvantages are
a.  Suffers from external fragmentation
b.  Suffers from internal fragmentation
c.  Difficulty in finding space for a new file
d. File cannot be extended
e.  Size of the file is to be declared in advance

4.What are the advantages of Linked allocation?

The advantages are
a.  No external fragmentation
b.  Size of the file does not need to be declared

5.What are the disadvantages of linked allocation?

The disadvantages are
a.  Used only for sequential access of files.
b.  Direct access is not supported
c.  Memory space required for the pointers.
d. Reliability is compromised if the pointers are lost or damaged

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, November 17, 2015

FILE SYSTEM



1.What are the most common schemes for defining the logical structure of a directory?

The most common schemes for defining the logical structure of a directory
  Single-Level Directory
  Two-level Directory
  Tree-Structured Directories
  Acyclic-Graph Directories
  General Graph Directory

2.Define UFD and MFD.

In the two-level directory structure, each user has her own user file directory (UFD). Each UFD has a similar structure, but lists only the files of a single user. When a job starts the system's master file directory (MFD) is searched. The MFD is indexed by the user name or account number, and each entry points to the UFD for that user.

3.What is a path name?

A pathname is the path from the root through all subdirectories to a specified file. In a two-level directory structure a user name and a file name define a path name.

4.What are the various layers of a file system?

The file system is composed of many different levels. Each level in the design uses the feature of the lower levels to create new features for use by higher levels.

  Application programs
  Logical file system
  File-organization module
  Basic file system
  I/O control
  Devices

Thursday, November 12, 2015

PROCESSES AND THREADS



11.What is schedulers?

A process migrates between the various scheduling queues through out its life time. The OS must select processes from these queues in some fashion. This selection process is carried out by a scheduler.

12.What are the use of job queues, ready queues and device queues?

As a process enters a system they are put in to a job queue. This queues consist of all jobs in the system. The processes that are residing in main memory and are ready and waiting to execute are kept on a list called ready queue. The list of processes waiting for a particular I/O devices kept in the device queue.

13.What is meant by context switch?

Switching the CPU to another process requires saving the state of the old process and loading the saved state for the new process. This task is known as context switch.

14.What is independent process?

A process is independent it cannot affect Or be affected by the other processes executing in the system. Any process does not share data with other process is a independent process.

15.What is co-operative process?

A process is co-operating if it can affect or be affected by the other processes executing in the system. Any process that share data with other process is a co-operating process.

Sunday, October 19, 2014

OS - Technical Questions

1. What are short, long and medium-term scheduling?
Long term scheduler determines which programs are admitted to the system for processing. It controls the degree of multiprogramming. Once admitted, a job becomes a process.
Medium term scheduling is part of the swapping function. This relates to processes that are in a blocked or suspended state. They are swapped out of real-memory until they are ready to execute. The swapping-in decision is based on memory-management criteria.
Short term scheduler, also know as a dispatcher executes most frequently, and makes the finest-grained decision of which process should execute next. This scheduler is invoked whenever an event occurs. It may lead to interruption of one process by preemption.

2. What are turnaround time and response time?
Turnaround time is the interval between the submission of a job and its completion. Response time is the interval between submission of a request, and the first response to that request.
3. What are the typical elements of a process image?
User data: Modifiable part of user space. May include program data, user stack area, and programs that may be modified.
User program: The instructions to be executed.
System Stack: Each process has one or more LIFO stacks associated with it. Used to store parameters and calling addresses for procedure and system calls.
Process control Block (PCB): Info needed by the OS to control processes.
4. What is the Translation Lookaside Buffer (TLB)?
In a cached system, the base addresses of the last few referenced pages is maintained in registers called the TLB that aids in faster lookup. TLB contains those page-table entries that have been most recently used. Normally, each virtual memory reference causes 2 physical memory accesses- one to fetch appropriate page-table entry, and one to fetch the desired data. Using TLB in-between, this is reduced to just one physical memory access in cases of TLB-hit.
5. What is the resident set and working set of a process?
Resident set is that portion of the process image that is actually in real-memory at a particular instant. Working set is that subset of resident set that is actually needed for execution. (Relate this to the variable-window size method for swapping techniques.)