Operating System Structure
Operating System Structure
4. The code and data for system calls are stored in global
kernel memory.
Why do you need system calls in Operating System?
There are various situations where you must require system calls
in the operating system. Following of the situations are as follows:
The caller need know nothing about how the system call is
implemented.
◦ Just needs to obey API and understand what OS will do as a
result call.
• If the request is permitted, the kernel performs the requested action, like
creating or deleting a file. As input, the application receives the kernel's
output.
• When the operation is finished, the kernel returns the results to the
application and then moves data from kernel space to user space in
memory.
How System Calls Work
• This control requires the ability to determine and reset the process
attributes like process priority, its maximum allowable execution time
etc. are set and retrieved by OS.
• After creating the new process, the parent process may have to wait
(wait time), or wait for an event to occur(wait event).
• The process sends back a signal when the event has occurred (signal
event).
In DOS, the command interpreter loaded first. Then loads the process and
transfers control to it. The interpreter does not resume until the process has
completed, as shown in Figure.
Fork system call creates a child that differs from its parent
process only in pid(process ID) and ppid(parent process ID).
Resource utilization is set to zero.
The fork() returns the PID of the child process. If the value is
non-zero, then it is parent process's id, and if this is 0, then
this is child process's id.
wait()
wait() system call suspends execution of current process until a
child has exited or until a signal has delivered whose action is
to terminate the current process or call signal handler.
exit()
2. Shared-memory model.
1.The message passing model must support calls to:
The communicating processes exchange messages with one another to
transfer information.
• Shared memory is faster, and is generally the better approach where large
amounts of data are to be shared.
• This model is difficult to implement, and it consists of only few system calls.
System programs provide a convenient environment for
program development and execution.
File manipulation
Status information
File modification
Communications
Application programs
File management - Create, delete, copy, rename, print,
dump, list, and generally manipulate files and directories.
Status information
Some ask the system for info - date, time, amount of
available memory, disk space, number of users , processes
running, data logging, etc.
• The first OS that was not written in assembly language was the
Master Control Program (MCP).
• They started as small, simple, and limited systems and then grew
beyond their original scope. Eg: MS-DOS.
• Each layer rests on the layer below it, and relies on the services
provided by the next lower layer.
• Bottom layer (layer 0) is the hardware and the topmost layer is the
user interface.
• A typical layer, consists of data
structure and routines that can be
invoked by higher-level layer.
• The layers are debugged one by one from the lowest and if any
layer doesn’t work, then error is due to that layer only, as the
lower layers are already debugged. Thus the design and
implementation is simplified.
A layer need not know how its lower level layers are implemented.
Thus hides the operations from higher layers.
Disadvantages of layered approach:
◦ More secure.
Detriments:
◦ Performance overhead of
user space to kernel
space communication.
Most modern operating systems implement kernel modules.
◦ Uses object-oriented approach.
◦ Each core component is separate.
◦ Each talks to the others over known interfaces.
◦ Each is loadable as needed within the kernel.
➢ The virtual machine is partitioned from the rest of the system, meaning
that the software inside a VM cannot interfere with the host computer's
primary operating system.
What are VMs used for?
VMs also allow for better security forensics and are often used to
safely study computer viruses, isolating the viruses to avoid risking
their host computer.