Basic CS-Operating System [3i Infotech Placement]: Sample Questions 59 - 60 of 89

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

Question 59

Operating System
Edit

Describe in Detail

Essay▾

When is a system in safe state?

Explanation

Safe State in Image
  • A process requests an available resource, system decides if immediate allocation leaves the system in a safe state.
  • System is in safe state if there exists a safe execution sequence for all processes- without causing deadlock
  • Sequence < P1, P2, … . Pn > is safe if for each Pi, the resource that Pi request can be satisfied by currently available resources and resources held by all the Pj, with J < I.
  • If Pi resource needs are not immediately available, them Pi can wait until all Pj have finished.
  • When Pj is finished, Pi can obtain need resources, execute, return allocated resources and terminate.
  • Pi terminates. Pi + 1 can obtain needed resources.

Question 60

Operating System
Edit

Describe in Detail

Essay▾

How to switch from kernel to user mode?

Explanation

  • User space application can explicitly initiate a switch to kernel mode by making a system call such as open, read, write etc.
  • A user application using system call APIs with appropriate parameters triggers software interrupts.
  • Code execution jumps from the user application to a predefined location in the Interrupt Vector Table provided by the OS.
  • IVT contains an address for the SWI exception handler routine.
  • Interrupt performs switches the user application to kernel mode and starts executing kernel instructions on user process.

Kernel Mode

  • Code has complete and unrestricted access to the underlying hardware.
  • Executes any CPU instruction and references any memory address
  • Reserved for the lowest-level, most trusted OS functions.

User Mode

  • Executing code has no ability to directly access hardware or reference memory.
  • User mode code delegates to system API to access hardware or memory.
  • Protection afforded by isolation- makes crashes in user mode recoverable.
  • Code and application normally executes in user mode.

Developed by: