Sunday, September 25, 2011

Operating system Short Question Part4


What are the different Dynamic Storage-Allocation methods? How to satisfy a request of size n from a list of free holes?
  • First-fit: Allocate the first hole that is big enough.
  • Best-fit: Allocate the smallest hole that is big enough; must search entire list, unless ordered by size. It produces the smallest leftover hole. 
  • Worst-fit: Allocate the largest hole; must also search entire list. Produces the argest left over hole. First-fit and best-fit are better than worst-fit in terms of speed and storage utilization.
 
What is fragmentation? Different types of fragmentation?
Fragmentation occurs in a dynamic memory allocation system when many of the free blocks are too small to satisfy any request. 
  • External Fragmentation: External Fragmentation happens when a dynamic memory allocation algorithm allocates some memory and a small piece is left over that cannot be effectively used. If too much external fragmentation occurs, the amount of usable memory is drastically reduced. Total memory space exists to satisfy a request, but it is not contiguous

  •  Internal Fragmentation: Internal fragmentation is the space wasted inside of allocated memory blocks because of restriction on the allowed sizes of allocated blocks. Allocated memory may be slightly larger than requested memory; this size difference is memory internal to a partition, but not being used Reduce external fragmentation by compaction 
  •  Shuffle memory contents to place all free memory together in one largeblock. 
  • Compaction is possible only if relocation is dynamic, and is done at execution time.
  
Under what circumstances do page faults occur? Describe the actions taken by the operating system when a page fault occurs?
A page fault occurs when an access to a page that has not been brought into main memory takes place. The operating system verifies the memory access, aborting the program if it is invalid. If it is valid, a free frame is located and I/O is requested to read the needed page into the free frame. Upon completion of I/O, the process table and page table are updated and the instruction is restarted. When a process is executed with only few pages in memory and when an instruction is encountered which refers to any instruction or data in some other page, which is not present in the main memory, a page fault occurs.
 

What is the cause of thrashing? How does the system detect thrashing? Once it detects thrashing, what can the system do to eliminate this problem?
Thrashing is caused by under allocation of the minimum number of pages required by a process, forcing it to continuously page fault. The system can detect thrashing by evaluating the level of CPU utilization as compared to the evel of multiprogramming. It can be eliminated by reducing the level of multiprogramming.

Describe different job scheduling in operating systems.
Scheduling is the activity of the deciding when process will receive the resources they request.
  • FCFS: FCSFS stands for First Come First Served. In FCFS the job that has been waiting the longest is served next.
  • Round Robin Scheduling: Round Robin scheduling is a scheduling method where each process gets a small quantity of time to run and then it is preempted and the next process gets to run. This is called time-sharing and gives the effect of all the processes running at the same time 
  • Shortest Job First: The Shortest job First scheduling algorithm is a nonpreemptive scheduling algorithm that chooses the job that will execute the shortest amount of time.
  • Priority Scheduling: Priority scheduling is a scheduling method where at all times the highest priority process is assigned the resource.
What is a Real-Time System? 
A real time process is a process that must respond to the events within a certain time period. A real time operating system is an operating system that can run real time processes successfully.
 A real time operating system is one in which the process has to respond within specified time limits.
Depending on this the real time operating system is of two types:
1) Hard Real-Time: in this system has to respond within the specified time  limits in case if it fails to respond within that time then the process is considered to be fail. e.g Robot Systems
2) Soft Real-Time: in this if system fails to respond within the specified time limits then the process is not considered to be failed rather it gets some more time from the system to get complete. 

What is the main component of operating system ?
Main component of operating system are kernel and shell. Shell is a interface between application program and kernel. Whenever application program wants some work to be done, it contacts kernel and kernel in turn perform work with the help of device drivers. Thus we can say kernel is an interface between hardware and shell. Kernel uses device drivers to control microcontroller card of peripheral device and in turn work is being accomplished. Application Program -> [shells ->kernel ->device driver -> controller card ->
physical hardware]

Explain briefly about, processor, assembler, compiler, loader, linker and the functions executed by them.
  • Processor: A processor is the part a computer system that executes instructions .It is also called a CPU.
  • Assembler: An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer's processor can use to perform its basic operations.Some people call these instructionsassembler language and others use the term assembly language.

  • Compiler:  A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or "code" that a computer's processor uses. Typically, a programmer writes language statements in a language such as Pascal or C one line at a time using an editor. The file that is created contains what are called the source statements. The programmer then runs the appropriate language compiler, specifying the name of the file that contains the source statements.
  • Loader: In a computer operating system, a loader is a component that locates a given program (which can be an application or, in some cases, part of the operating system itself) in offline storage (such as a hard disk), loads it into main storage (in a personal computer, it's called random access memory), and gives that program control of the computer.
  • Linker:  Linker performs the linking of libraries with the object code to make the object code into an executable machine code.