DEV Community

Cover image for Top 10 Operating Systems Interview Questions
Ayush Agarwal
Ayush Agarwal

Posted on • Originally published at ayushdev.com

Top 10 Operating Systems Interview Questions

Its placement season going on here in India!

Despite the COVID-19 Pandemic the colleges across India are doing best to get the final year student recruited by the best companies around the world.

Hello guys, I am an undergrad student at VIT,Vellore,India and I recently got recruited as a software developer. In this blog I will share about something which is very important to know if anyone is looking for a tech role.

Yes, as the title says and the reason you are readin-g is, I will pen down the top 10 questions which I feel are very important in Operating Systems and you may encounter these problems in your next interview.

os blog between image.jpg

Coming to tech roles interviews almost everyone who has reached the interview round knows how to solve coding problems, but one thing that sets you apart is your miscellaneous knowledge in other Computer Science subjects like OS,DBMS AND Networking.

So,stay tuned and read it to full to ace your next tech interview.

I will list the question and then a small answer for each of them. At the end I will share some useful links which I referred to study them and so can you.

To begin with the first very general question that is asked is,

1. What is multitasking, multithreading, multiprocessing and multiprogramming?

The answer for this is quite simple and it goes as:

  • Multitasking: Running multiple tasks on a single CPU.
  • Multithreading: Extension of Multitasking i.e multiple segments of a single task.
  • Multiprocessing: Using more than a single CPU at once.
  • Multiprogramming:Running more than one program at once like music along with code.

2. What is scheduling and what are its two types?

This is one of the most important questions as far as interview question on OS is considered. The answer to the question is:
Scheduling is handling the execution of a process. Scheduling is responsible to remove the executed process from CPU and insert the next process to be executed.

The two types of scheduling are:

  • Preemptive Scheduling
  • Non-Preemptive Scheduling

3. What are the different types of Scheduling algorithms?

For this question you only need to remember the definition of the algorithms and one real life example of each.
So to start with we have:

  • First Come First Serve/FCFS: As the name suggests, in this algorithm the process which came first to CPU will be executed first. It is a non-preemptive type scheduling. One another important concept in FCFS is Convoy Effect, which just means that suppose a process which is too long comes first than until unless it is executed the other process can't be executed even if they have shorter execution time. A picture to demonstrate Convoy Effect:

Capture.PNG
Image source: Convoy Effect Image

  • Shortest Job First/SJF: Process with the smallest execution time is selected to be executed. It is also a non-preemptive scheduling.
  • Longest Job First/LJF: Just the opposite of SJF.
  • Shortest Time Remaining First/SRTF: Preemptive version of SJF.
  • Longest Time Remaining Fisrt/LRTF: Preemptive version of LJF. Process with maximum remaining time is processed first. Then after a while it is again checked if any other process having more burst time arrived at CPU or not.

  • Round Robin Scheduling:Each job is given a time slot/quantum to execute. It is a preemptive scheduling.

4. What is deadlock and starvation?

Deadlock is a kind of locking situation where each process is holding a resource and waiting for another process to release its resource so that it can execute.
For a simple example, consider a single track and two trains facing each other on the track. Now none of the trains can move.

Starvation occurs when there are some process which never ends up getting resources to execute itself.

5. What are the different characteristics of deadlock?

Deadlock has the following characteristics:

  • Mutual Exclusion
  • Hold and Wait
  • No Preemption
  • Circular Wait

You may be asked on how can we avoid those which you can read from the reference links I have given below.

6. What is Bankers Algorithm?

It is a resource allocation and deadlock avoidance algorithm which test all the request made by processes for resources, it checks for the safe state, if after granting request system remains in the safe state it allows the request and if there is no safe state it doesn’t allow the request made by the process. {Inspired from GeeksforGeeks since it was best explained there}

The request made by the process will only be granted if:

  • If the request made by the process is less than equal to max need to that process.
  • If the request made by the process is less than equal to the freely available resource in the system.

7. What is memory management and name the techniques used in doing so?

There are various programs which are running and it is very important to assign calculated memory to various running programs for the best optimal usage of the computer memory. This is called Memory Management.

There are four common memory management techniques:

  • Single contiguous allocation: All memory except some reserved for OS is available.
  • Partitioned allocation: Memory is divided into different blocks and each process is allocated according to requirement.
  • Paged memory management:Memory is divided into fixed sized units called page frames, used in a virtual memory environment.
  • Segmented memory management: Memory is divided in different segments (a segment is a logical grouping of the process’ data or code).In this management, allocated memory doesn’t have to be contiguous.

8. Explain critical section?

When more than one processes access a same code segment that segment is known as critical section. Critical section contains shared variables or resources which are needed to be synchronized to maintain consistency of data variable.

9. What is paging?

Paging is a memory management scheme that eliminates the need for contiguous allocation of physical memory. Read more on paging here which is explained beautifully: Paging

10. Name a few process synchronization algorithms?

In general you may be asked to explain the algorithms. Be sure that you'll not be asked to write the code of any algorithms.

So, algorithms which are used in process synchronization are:

  • Reader Writer Algorithm
  • Dining Philosopher Algorithm
  • Peterson's Algorithm

If asked any of these, explaining just the algorithm is fine.

Huff, that is a long list of questions. I feel that covering these questions you are more than covered up for any question on Operating Systems.

If you have more time and want to cover more topics and in details below I am sharing the list of important topics which I tweeted a few days ago. You can cover those too for extra knowledge and info.

List of important topics to study in OS: Its a thread tweet so read it all for complete info.

%[https://twitter.com/its_ayush24/status/1297887038402772993]

Next and last is the reference to few sources which have great content to study Operating Systems.

That's it in this blog, I hope that this will help. I have used my interview experience to pile these questions.

Write down your views in the comments section below and subscribe to my newsletter to read my blogs as soon as they are released.

*Keep Learning and Keep Practicing!! *

Top comments (0)