os

1.What is an operating system?
Operating System is a collection of programs which act as an interface between user of a computer 
and the computer hardware.
The purpose of an operating system is to provide an environment in which a user can execute 
programs in a convenient  and efficient manner.

2. Explain PCB with neat diagram.
Process Control Block(PCB) also known as Task Control Block. PCB is a data structure which is used 
by the operating system. Operating System is groups of all information that is needed about a 
particular process. PCB acts as a storage for any information for the process. The information are 
process ID, process state, process priority, program counter, CPU register etc. 
When a process is created, the OS creates a corresponding PCB  for the process. 
When a process is terminated its PCB is released to free the memory location. 
Also note that a process can complete only when it has active PCB associated with it.

  • Pointer: Pointer points to another PCB. pointer is used for maintaining the scheduling list.
  • Process State:Process state may be New, ready, running, waiting and so on.
  • Program Counter: Program Counter indicates the address of the next instruction to be executed
     for this process.
  • CPU Register: The CPU registers are  accumulator, base, registers and general purpose registers.
  • Memory Allocation: This field contains the information about memory management system used by 
    operating system. This may include the page tables, segment tables etc.
  • Accounting Information : This information includes the amount of CPU and real time use, time limits,
     jobs or process numbers,account numbers.
  • Open files list :This information includes the list of files opened for a process.

    3.What is thread? Write three points to differentiate it from process.
    Thread:  
    Thread is a lightweight process.One process may have number of threads. It is called lightweight
    because different threads belonging to one process, can share the same resources used by that process.
    When a process has one thread , then it is called single threading. If a process have number of threads,
     then it is called multi-threading.

                        Process
                            Thread
    i)Different process can not share the same
     memory space.
    i)Different Threads belonging to one process
     so different threads  can share the same
     memory and field. 
    ii)Process creation take more time.
    ii)Thread creation take less time.
    iii)Process takes more time to execute
     and terminated.
    iii)Thread takes less time to execute and 
    terminated.

    iv)Process is heavy weight.
    iv)Thread is lightweight.
    v)It takes more time to switch between 
    two process.
    v)It takes less time to switch between 
    two process.
     4.Explain the state transition diagram of a process.

    State Transition Process Diagram



    New :
    In this state the process  is being created.
    Ready:
    In this state different process are waiting for assigned in processor  and the process are selected by a scheduler.
    Running:
    When a process selected by scheduler then it goes to the processor to run.In running state the process may be interrupted and the process goes to the ready state.And again in the ready state a process is selected by a scheduler.
    Waiting:
    In this state a process may be blocked or have  to wait for some input-output event.When the input output event is completed the  process will go to the ready state.
    Terminated:
    When the execution of a process is completed, the OS terminate the process from the running state.

    5.Difference between multilevel feedback queue and multilevel queue scheduling algorithm.


    Multi level feedback queue
    Multi level queue scheduling
    It allows a process to move between the queues, according to the characteristics of their CPU burst.
    In multi level queue scheduling the ready queue is apartion into number of ready queue each ready queue has it own scheduling algo and it is capable to load some type of jobs.









    \


     

    8.Short note on round robin algorithm.
    video tutorial

  • Round Robin is the preemptive process scheduling algorithm.
  • Each process is provided a fix time to execute, it is called a quantum.
  • Once a process is executed for a given time period, it is preempted and other process executes for a given time period.
  • Context switching is used to save states of preempted processes.
9.Suppose that the process arrive for execute at the time indicated 
Process
Arrival time
Burst time
Priority
P 0
0
5
2
P 1
2
7
4
P 2
3
9
1
P 3
3
4
5
P 4
4
3
3

Draw the Gantt chart and calculate the average waiting time for:-
FCFS scheduling algorithm.
Priority scheduling algorithm.
Pre-emptive SJF scheduling algorithm.
Round robin scheduling algorithm.                [2+2+2+2=8]

10.Difference between preemptive and nonpreemptive.
    ex-    RR                   FCFS

12.What is spooling?

Spooling mean simultaneous peripheral operation online.
Simultaneous mean if 2 or more user issu the print commmand and the printer accept the request 
even the printer printing some other jobs. The printer printing one job at the same time the spool disk
 can load some other jobs.
spool disk is a temporary buffer, it can read data from secondary storage device directly. 
Simultaneously the cpu execute some other jobs in the spool disk at the same time the printer 
printer the third job, so three jobs are running simultaneously.








13) Different between fork() and vfork() ?
https://techdifferences.com/difference-between-fork-and-vfork.html 

14)Difference between preemptive and nonpreemptive scheduling ?  
Taken form






15)Difference between starvation and deadlock ?
Taken form 
 

16)Difference between internal and external fragmentation.

17)Best Fit, Worst Fit, First fit.
Visit this site 

Comments

Popular Posts