Question
Operating Systems


1. Name three ways in which the processor can transition from user mode to kernel mode? 2. What is a process? What is a threa
0 0
Add a comment Improve this question Transcribed image text
Answer #1

(1)

Following are the ways in which processor can switch from user mode to kernel mode:

  • Whenever the user process executes system call.
  • when the CPU(processor ) responds to  an interrupt generated.
  • Whenever the processor come across synchronous exceptions such as TRAPs.(Divide by zero, page faults etc).

(2)

Process:

  • A process is something which is created to execute a program or A program in execution is called as a process.
  • Process Control Block(PCB) holds control on a process It contains meta data about a process like process id, program counter, process state, general purpose registers, protection etc.
  • A process use system call like fork() to create it's child processes.
  • It is isolated i.e, doesn't share any segment of code section or data section of memory with other processes.
  • Takes more time to creation, termination and context switching.

Thread:

  • A segment/part of the process or a lightweight process(requires less memory) is referred as thread.
  • Threads share code and data section of memory unlike a process.
  • Takes less time for creation, termination and context switching.

Example:

Suppose there is a process in which it has to read 100 files. Since file reading is not involving any CPU, if there is only single thread of control it reads files one by one. So it is better to create 100 threads for a process so that read of 100 files can happen parallelly since file reading is I/0.

(3)

Preemptive Scheduling:

  • A scheduling in which CPU resources (cycles) are granted to a process for a limited time and after that time a process forcefully pulled back from cpu and process again kept back in ready state and gets scheduled back again if it still has any leftover burst time.
  • The process which is in execution will be obstructed in the middle if any other higher priority process gets scheduled.
  • Examples are: Round Robin, Shortest Job First (preemptive)(SJF) etc.

Non-Preemptive Scheduling:

  • In this type scheduling resources allocated to process are for life time of a process i.e, till it gets terminated.
  • No interruption of a process during it's execution to till it's completion even if any other higher priority process gets scheduled.
  • Examples include First come first serve (FCFS), SJF (non-preepmtive) etc

  

Add a comment
Know the answer?
Add Answer to:
Operating Systems 1. Name three ways in which the processor can transition from user mode to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT