edited by
11,102 views
12 votes
12 votes

Which one or more of the following options guarantee that a computer system will transition from user mode to kernel mode?

  1. Function Call
  2. malloc Call
  3. Page Fault
  4. System Call
edited by

3 Answers

9 votes
9 votes
  1. function call: functions may be user defined so It also does not guarantee to switch from user to kernel mode.
  1. Malloc () call: It can be done in both user and kernel modes. Hence, It cannot guarantee switching.
  1. Page fault : When a page fault occurs, required page must be loaded from secondary to main memory. It will be done in privileged mode and guarantee user mode to kernel mode switching.
  1. System call : System calls are executed  in kernel mode only. It definitely guarantee switching.

Hence Ans is C,D.

6 votes
6 votes
System Call guarantees that a computer system will transition from user mode to kernel mode.

System calls are the mechanism by which user-level programs can request services from the operating system (OS) and transition from user mode to kernel mode. When a user-level program executes a system call, it causes an interrupt to occur, which transfers control to the OS kernel. The OS kernel then performs the requested service and returns control to the user-level program.

Function calls and malloc calls do not necessarily result in a transition to kernel mode. They are both operations that can be performed entirely within user mode.

A page fault can trigger a transition to kernel mode, but it is not guaranteed to do so. A page fault occurs when a program attempts to access a page of memory that is not currently in physical memory. In this case, the OS must handle the page fault and may need to allocate physical memory or swap pages in/out of memory. This requires kernel mode access, but some page faults can be handled entirely within user mode without kernel intervention.
4 votes
4 votes

Options A, C, and D should be straightforward. (Comment if you have any doubts)

For option B, a good read is available here https://stackoverflow.com/a/5716525

The point 1 in above link is important here,

malloc() will search its managed pieces of memory to see if there's a piece of unused memory that satisfy the allocation requirements.

It implies that a system call is not required (therefore no switch to kernel mode) to satisfy the requirement.

Hence, answer is C, D.

Answer:

Related questions

8 votes
8 votes
1 answer
1
20 votes
20 votes
5 answers
2
admin asked Feb 15, 2023
14,194 views
Which one or more of the following $\text{CPU}$ scheduling algorithms can potentially cause starvation?First-in First-OutRound RobinPriority SchedulingShortest Job First