In a multitasking system, the operating system must ensure reasonable
response time. A common method for doing so is
virtual memory
, a tech-
nique that allows the execution of a process that is not completely in memory
(Chapter 10). The main advantage of this scheme is that it enables users to
run programs that are larger than actual
physical memory
. Further, it abstracts
main memory into a large, uniform array of storage, separating
logical mem-
ory
as viewed by the user from physical memory. This arrangement frees
programmers from concern over memory-storage limitations.
Multiprogramming and multitasking systems must also provide a file sys-
tem (Chapter 13, Chapter 14, and Chapter 15). The file system resides on a
secondary storage; hence, storage management must be provided (Chapter 11).
In addition, a system must protect resources from inappropriate use (Chapter
17). To ensure orderly execution, the system must also provide mechanisms for
process synchronization and communication (Chapter 6 and Chapter 7), and it
may ensure that processes do not get stuck in a deadlock, forever waiting for
one another (Chapter 8).
1.4.2
Dual-Mode and Multimode Operation
Since the operating system and its users share the hardware and software
resources of the computer system, a properly designed operating system must
ensure that an incorrect (or malicious) program cannot cause other programs
—or the operating system itself—to execute incorrectly. In order to ensure
the proper execution of the system, we must be able to distinguish between
the execution of operating-system code and user-defined code. The approach
taken by most computer systems is to provide hardware support that allows
differentiation among various modes of execution.
At the very least, we need two separate
modes
of operation:
user mode
and
kernel mode
(also called
supervisor mode
,
system mode
, or
privileged
mode
). A bit, called the
mode bit
, is added to the hardware of the computer
to indicate the current mode: kernel (0) or user (1). With the mode bit, we can
distinguish between a task that is executed on behalf of the operating system
and one that is executed on behalf of the user. When the computer system is
executing on behalf of a user application, the system is in user mode. However,
when a user application requests a service from the operating system (via a
system call), the system must transition from user to kernel mode to fulfill

1.4
Operating-System Operations
25
user process executing
user process
kernel
calls system call
return from system call
user mode
(mode bit = 1)
trap
mode bit = 0
return
mode bit = 1
kernel mode
(mode bit = 0)
execute system call
Figure 1.13
Transition from user to kernel mode.
the request. This is shown in Figure 1.13. As we shall see, this architectural
enhancement is useful for many other aspects of system operation as well.
