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

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.
 

Operating system Short Question Part3

What is a Safe State and what is its use in deadlock avoidance?
Safe State:
When a process requests an available resource, system must decide if immediate allocation leaves the system in a safe state. System is in safe state if there exists a safe sequence of all processes. Deadlock Avoidance: Ensure that a system will never enter an unsafe state. 

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.
   
What is MUTEX?

Mutex is a program object that allows multiple program threads to share the same resource, such as file access, but not simultaneously. When a program is started a mutex is created with a unique name. After this stage, any thread that needs the resource must lock the mutex from other threads while it is using the resource. The mutex is set to unlock when the data is no longer needed or the routine is finished. 
 

Operating system Short Question Part2

What are multi tasking, multi programming and multi threading? 
  • Multi programming: Multiprogramming is the technique of running several programs at a time using timesharing. It allows a computer to do several things at the same time. Multiprogramming creates logical parallelism. The concept of multiprogramming is that the operating system keeps several jobs in memory simultaneously. The operating system selects a job from the job pool and starts executing a job, when that job needs to wait for any i/o operations the CPU is switched to another job. So the main idea here is that the CPU is never idle.
  • Multi tasking: Multitasking is the logical extension of multi-programming .The concept of multitasking is quite similar to multiprogramming but difference is that the switching between jobs occurs so frequently that the users can interact with each program while it is running. This concept is also known as time-sharing systems. A time-shared operating system uses CPU scheduling and multiprogramming to provide each user with a small portion of time-shared system. 
  • Multi threading: An application typically is implemented as a separate process with several threads of control. In some situations a single application may be required to perform several similar tasks for example a web server accepts client requests for web pages, images, sound, and so forth. A busy web server may have several of clients concurrently accessing it. If the web server ran as a  traditional single-threaded process, it would be able to service only one client at a time. The amount of time that a client might have to wait for its request to be serviced could be enormous. So it is efficient to have one process that contains multiple threads to serve the same purpose. This approach would multithread the web-server process, the server would create a separate thread that would listen for client requests when a request was made rather than creating another process it would create another thread to service the request. To get the advantages like responsiveness, Resource sharing economy and utilization of multiprocessor architectures multithreading concept can be used.

Operating system Short Question Part1

What are the basic functions of an operating system?
Operating system controls and coordinates the use of the hardware among the various application programs for various uses. Operating system acts as resource allocator and manager. Since there are many possibly conflicting requests for resources, the operating system must decide which requests are allocated resources to operating the computer system efficiently and fairly. Also, operating system is control program which controls the user programs to prevent errors and improper use of the computer. It is especially concerned with the operation and control of I/O devices.
 
Why paging is used?   
Paging is solution to external fragmentation problem which is to permit the logical address space of a process to be noncontiguous, thus allowing a process to be allocating physical memory wherever the latter is available.

What resources are used when a thread created? How do they differ from those when a process is created?
When a thread is created the threads does not require any new resources to execute the thread shares the resources like memory of the process to which they belong to. The benefit of code sharing is that it allows an application to have several different threads of activity all within the same address space. Whereas if a new process creation is very heavyweight because it always requires new address space to be created and even if they share the memory then the inter process communication is expensive when compared to the communication between the threads.
What is virtual memory?
Virtual memory is hardware technique where the system appears to have more memory that it actually does. This is done by time-sharing, the physical memory and storage parts of the memory one disk when they are not actively being used. 

What is Throughput, Turnaround time, waiting time and Response time?
Throughput: Number of processes that complete their execution per time unit. Turnaround Time: Amount of time to execute a particular process. Waiting Time: Amount of time a process has been waiting

Thursday, September 8, 2011

Operating System Overview 1

                                         Operating System

Today computer is associate with our daily life frequently.The computer nothing useful with out operating system.So we have to learn OS to maintain our computer.
WHAT IS OPERATING SYSTEM?
Operating system is a system software that act as an intermediary between user and hardware.It provides the platform to run application software and execute program by help of hardware.

OS is generally divided into two parts one is -SHELL another is KERNEL.SHELL is usually interact with the user  or application software.we write some program to shell (shell script).Those program or application is interpreted by the help of KERNEL and it convert to the corresponding machine code of the program and execute it by the help of hardware.So KERNEL is interact with hardware.
So one question is important kernel is software or hardware?The answer is obviously hardware because kernel is a part os which is a system software.so kernel can't be hardware.