How does Windows NT supports Multitasking?



How does Windows NT supports Multitasking?..

Answer / asd

Preemptive multitasking differs from non-preemptive
multitasking in that the operating system can take control
of the processor without the task's cooperation. (A task can
also give it up voluntarily, as in non-preemptive
multitasking.) The process of a task having control taken
from it is called preemption. Windows NT uses preemptive
multitasking for all processes except 16-bit Windows 3.1
programs. As a result, a Window NT application cannot take
over the processor in the same way that a Windows 3.1
application can.

A preemptive operating system takes control of the processor
from a task in two ways:

When a task's time quantum (or time slice) runs out. Any
given task is only given control for a set amount of time
before the operating system interrupts it and schedules
another task to run.

When a task that has higher priority becomes ready to run.
The currently running task loses control of the processor
when a task with higher priority is ready to run regardless
of whether it has time left in its quantum or not.

Switching Among Tasks

At any given time, a processor (CPU) is executing in a
specific context. This context is made up of the contents of
its registers and the memory (including stack, data, and
code) that it is addressing. When the processor needs to
switch to a different task, it must save its current context
(so it can later restore the context and continue execution
where it left off) and switch to the context of the new
task. This process is called context switching .

When Windows NT switches tasks, it saves all of the
registers of the task it's leaving and re-loads the
registers of the task to which it's switching. This process
also enables the proper address space for the task to which
Windows NT is switching.

Processes and Threads

In addition to being a preemptive multitasking operating
system, Windows NT is also multithreaded, meaning that more
than one thread of execution (or thread ) can execute in a
single task at once.

A process comprises:

A private memory address space in which the process's code
and data are stored.

An access token against which Windows NT makes security checks.

System resources such as files and windows (represented as
object handles).

At least one thread to execute the code.

A thread comprises:

A processor state including the current instruction pointer.

A stack for use when running in user mode.

A stack for use when running in kernel mode.

Since processes (not threads) own the access token, system
resource handles, and address space, threads do NOT have
their own address spaces nor do they have their own access
token or system resource handles. Therefore, all of the
threads in a process SHARE the same memory, access token,
and system resources (including quota limits) on a
"per-process" rather than a "per-thread" basis. In a
multithreaded program, the programmer is responsible for
making sure that the different threads don't interfere with
each other by using these shared resources in a way that
conflicts with another thread's use of the same resource.
(As you might suspect, this can get a little tricky.)

Sources:
http://technet.microsoft.com/en-us/library/cc767883.aspx

Is This Answer Correct ?    5 Yes 2 No

Post New Answer

More Operating Systems General Concepts Interview Questions

Is bgp layer 3 or 4?

0 Answers  


Explain Round Robin.

0 Answers   Genpact,


What are the different memories you know about? Which of them takes the shortest access time?

0 Answers   Wipro,


Do 32 bit programs run faster on 64bit?

0 Answers  


Explain the various types of registers?

0 Answers  






Explain the concept of Thread Pool? what its Benefits?

0 Answers   Sans Pareil IT Services,


What is storage management in operating system?

0 Answers   Honeywell, Huawei, Zomato,


What do you mean by ram?

0 Answers  


When is a system in a safe state?

0 Answers  


What are loosely coupled systems?

0 Answers  


Explain segmentation with paging?

0 Answers  


What is ie tab in chrome?

0 Answers  


Categories