Operating System-Unix [3i Infotech Placement]: Sample Questions 55 - 57 of 78

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 55

Edit

Write in Short

Short Answer▾

Predict the output of the following program code:

  1. main ()
  2. {
  3.     fork(); fork(); fork();
  4.     print(“HelloWorld”);
  5. }

Explanation

Each subsequent fork is executed by both parent and child and so on. First form is executed once by the parent creating 2 children. Second fork is executed by both parent and child creating 2 more children (total now becomes 4) . Third is executed by all 4 children creating 4 more children for a total of 8 processes. Thus in general “Hello World” is printed times where n is the number of calls to fork () .

Question 56

Edit

Write in Short

Short Answer▾

For which kind of fault the page is checked first?

Explanation

  • The page is first checked for the validity fault. Kernel handles the validity fault.
  • Processes incur protection fault for other reasons which are checked later.

Question 57

Edit

Describe in Detail

Essay▾

How the Swapper works?

Explanation

  • Swapper is the process that swaps other processes.
  • Moving the information from fast access memory and slow access memory and vice versa is known swapping.
  • The physical RAM is divided into chunks of memory known as pages.
  • A page memory is copied to the preconfigured space on the hard disk, for the purpose of freeing up that page of memory.
  • The commands swapon and swapoff are used in linux/unix to perform swapping.
  • The swapon is to enable the swapping and the swap off is to disable swapping.
  • On “swapon” The first task for the kernel is to start the swapper process.
  • The swapper process is the part of the kernel that schedules other process.
  • The swapper has process ID of 0.

Developed by: