Vous êtes sur la page 1sur 7

GeeksQuiz

Computer Science Quizzes for Geeks !

Suggest Practice
GeeksforGeeks

Placements GATE Q&A

Commonly Asked
Questions | Set 1

Operating

Systems

Interview

What is a process and process table? What are different states of process
A process is an instance of program in execution. For example a Web Browser is a process, a shell (or command
prompt) is a process.
The operating system is responsible for managing all the processes that are running on a computer and allocated each
process a certain amount of time to use the processor. In addition, the operating system also allocates various other
resources that processes will need such as computer memory or disks. To keep track of the state of all the processes,
the operating system maintains a table known as the process table. Inside this table, every process is listed along with
the resources the processes is using and the current state of the process.
Processes can be in one of three states: running, ready, or waiting. The running state means that the process has all the
resources it need for execution and it has been given permission by the operating system to use the processor. Only
one process can be in the running state at any given time. The remaining processes are either in a waiting state (i.e.,
waiting for some external event to occur such as user input or a disk access) or a ready state (i.e., waiting for
permission to use the processor). In a real operating system, the waiting and ready states are implemented as queues
which hold the processes in these states. The animation below shows a simple representation of the life cycle of a
process (Source: http://courses.cs.vt.edu/csonline/OS/Lessons/Processes/index.html)
What is a Thread? What are the differences between process and thread?
A thread is a single sequence stream within in a process. Because threads have some of the properties of processes,
they are sometimes called lightweight processes. Threads are popular way to improve application through parallelism.
For example, in a browser, multiple tabs can be different threads. MS word uses multiple threads, one thread to format
the text, other thread to process inputs, etc.
A thread has its own program counter (PC), a register set, and a stack space. Threads are not independent of one other
like processes as a result threads shares with other threads their code section, data section and OS resources like open
files and signals. See http://www.personal.kent.edu/~rmuhamma/OpSystems/Myos/threads.htm for more details.
What is deadlock?
Deadlock is a situation when two or more processes wait for each other to finish and none of them ever finish.
Consider an example when two trains are coming toward each other on same track and there is only one track, none of
the trains can move once they are in front of each other. Similar situation occurs in operating systems when there are
two or more processes hold some resources and wait for resources held by other(s).
What are the necessary conditions for deadlock?
Mutual Exclusion: There is s resource that cannot be shared.

Hold and Wait:A process is holding at least one resource and waiting for another resource which is with some other
process.
No Preemption: The operating system is not allowed to take a resource back from a process until process gives it back.
Circular Wait: A set of processes are waiting for each other in circular form.
What is Virtual Memory? How is it implemented?
Virtual memory creates an illusion that each user has one or more contiguous address spaces, each beginning at
address zero. The sizes of such virtual address spaces is generally very high.
The idea of virtual memory is to use disk space to extend the RAM. Running processes dont need to care whether the
memory is from RAM or disk. The illusion of such a large amount of memory is created by subdividing the virtual
memory into smaller pieces, which can be loaded into physical memory whenever they are needed by a process.
What is Thrashing?
Thrashing is a situation when the performance of a computer degrades or collapses. Thrashing occurs when a system
spends more time processing page faults than executing transactions. While processing page faults is necessary to in
order to appreciate the benefits of virtual memory, thrashing has a negative affect on the system. As the page fault rate
increases, more transactions need processing from the paging device. The queue at the paging device increases,
resulting in increased service time for a page fault (Source: http://cs.gmu.edu/cne/modules/vm/blue/thrash.html)

What is Beladys Anomaly?


Bldys anomaly is an anomaly with some page replacement policies where increasing the number of page frames
results in an increase in the number of page faults. It occurs with First in First Out page replacement is used. See the
wiki page for an example and more details.
Differences between mutex and semphore?
Seehttp://www.geeksforgeeks.org/mutex-vs-semaphore/
Practice Quizzes on Operating System topics
Last Minute Notes OS
OS articles
We will soon be covering more Operating System questions. Please write comments if you find anything incorrect, or
you want to share more information about the topic discussed above.

See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all
Quizzes on GeeksQuiz.

Category: Operating Systems

(Login to Rate and Mark)


Average Rating : 4/5.0
Average Difficulty : 3/5.0

Based on 6 vote(s)

Based on 2 vote(s)

Add to TODO List


Mark as DONE

Like

Share Sign Up to see what your friends like.

Sponsored Links

Baracks Worst Nightmare! Malia Obama Caught PARTYING In Amsterdam


Radar Online

These 6 Foods Are the Reason You Can't Sleep, According to a Nutritionist
Byrdie

How to learn any language in just 7 days


Babbel

Vikings: Free Strategy MMO Game that will get you addicted!
Viking - Online Game

13 Comments
Recommend 5

GeeksQuiz

Share

Join the discussion

Login

Sort by Best

Join the discussion

karunakar
2 years ago

just modify thrashing question which u r posted here...


thrashing is a situation that when a process is executing in the processor it requested the pages when it
is under allocation of minimum no. of pages to the process forcing it to continuously page fault ,in this
pages swap in swap out period system utilization is very low then system think that in order to increase
degree of multiprogramming it adds one more process to the ready queue instead of decrease the page
faults now page fault rate is more for new and old process it go on some point system reaches
perticular threshold or system crash point called system thrashed or system crashed in order to avoid
thrashing degree the degree of multiprogramming.
2

Reply

bale30
2 years ago

thanks a lot :) . more questions pls :)


2

Reply

Manish Joshi
a year ago

hey geeksforgeeks admin,


u're works are great. ONLY major thing missing is u should add links to next related article so that we
don't have to search once we are done reading. Thanks
1

Reply

AWormOnTheWeb
3 months ago

The link specified in the answer for the first question leads to nowhere.

Reply

naruto
9 months ago

Good questions

Reply

Ankit Singh
a year ago

Nice set of questions. Since Semaphore and Mutexe is the most popular of all, I've written a concise
post on it. Check it out here http://theleancoder.net/index....

Reply

amit
a year ago

a year ago

plz extend the topics

Reply

Rahul
a year ago

thank you very much it helps me a lot!!

Reply

Shubham Aggarwal
2 years ago

When will new questions come by?

Reply

yelpz
2 years ago

can someone explain the meaning of safe state or safe sequence in the deadlock topic ??

Reply

Rahul Kumar > yelpz


a year ago

There are any processes in the CPU and all of them have been allocated certain resources by the
CPU and many of them may still need more resources for complete execution.
A state is safe if the OS can allocate all
resources requested by all processes (up to their stated maximums)
without entering a deadlock state.
A state is safe if there exists a safe sequence of processes { P0, P1, P2, ..., PN } such that all of the
resource
requests for Pi can be granted using the resources currently allocated
to Pi and all processes Pj where j < i. ( i.e. if all the processes
prior to Pi finish and free up their resources, then Pi will be able to
finish also, using the resources that they have freed up.)

Reply

Shubham Aggarwal > yelpz


2 years ago

Basically, Safe state refers to the current state of a processor. It is achieved by following a safe
sequence of processes that must be followed in that manner to achieve a safe state. So, sequence is
path, state is destination.

Reply

heehee > yelpz


2 years ago

refer galvin book. nicely explained. or watch youtube vid :)

Reply

Reply

Subscribe d Add Disqus to your site Add Disqus Add

Privacy

@geeksforgeeks Some rights reserved Contact Us! About Us!

Vous aimerez peut-être aussi