Information Technology: OPERATING SYSTEM(OS) #2
Hi, everybody!
Let's learn something new about operating system together.
To those who are not familiar with operating system, check out the following link please.
Information Technology: OPERATING SYSTEM(OS) #1
Process
The execution of an application program with restricted rights is called a process.
A process’s access to hardware is mediated and checked by the operating system kernel. The difference between a process and a program is that a process is an instance of a program.
A “process” was originally coined to mean what we now call a “thread”.
A process executes a program, consisting of one or more threads running inside a protection boundary.
a programmer types up some code in some appropriately high-level language. A compiler converts that code into a sequence of machine instructions, and stores those instructions into a file, called the executable image of the program. The compiler also defines any static data the program needs, along with their initial values, and includes them in the executable image. To start the program running, the operating system copies the program instructions and data from the executable image into physical memory.
The process control block stores all the information the operating system needs about a particular process: where it is stored in memory, where its executable image is on disk, which user asked it to start executing, what privileges the process has, and so forth.
Operating system kernel
Image URL
A kernel is the core component of an operating system. Implementing protection is the job of the operating system kernel. The kernel is the lowest level of software running on the system, with full access to all of the capabilities of the hardware. The operating system kernel runs directly on the processor with unlimited rights. Using inter-process communication and system calls, it acts as a bridge between applications and the data processing performed at the hardware level. When an operating system is loaded into memory, the kernel loads first and remains in memory until the operating system is shut down again. The kernel is responsible for low-level tasks such as disk management, task management and memory management.
The kernel is necessarily trusted to do anything that can be done with the hardware. Everything else — that is, the untrusted software running on the system — is run in a restricted environment, with less than complete access to the full power of the hardware. Applications need to run on the processor with all potentially dangerous operations disabled.
The kernel is typically responsible for the following:
· Process management for application execution
· Memory management, allocation and I/O
· Device management through the use of device drivers
· System call control, which is essential for the execution of kernel services
Some types of kernels:
Monolithic Kernels:
Entire OS is placed in kernel space
All OS code runs in privileged mode
Higher performance but higher risk for system crash:
All the services are placed inside the kernel; therefore, the access time would be
less. As a result, the performance will be higher. However, if a hardware driver or some basic stuff crashes or turns unresponsive, the entire system will crash.
In monolithic operating systems, virtually any procedure can call any other procedure. Such lack of structure was unsustainable as operating systems grew to massive proportions.
Microkernels:
In computer science, a microkernel (a small OS core) is the near-minimum amount of software that can provide the mechanisms needed to implement an operating system. In philosophy underlying the microkernel is that only absolutely essential core OS functions should be in the kernel. In theory, this approach provides a high degree of both flexibility and modularity. Less essential services and applications are built on the microkernel and execute in user mode.
Hybrid Kernels:
Hybrid kernel is a kernel architecture based on an amalgamation of microkernel and monolithic kernel architecture utilized in computer operating systems. This kernel approach amalgamates the speed and simpler design of monolithic kernel with the modularity and execution safety of microkernel.
Dual-mode operation
A very simple, safe, and entirely hypothetical approach would be to have the operating system kernel simulate, step by step, every instruction in every user process.
Instead of the processor directly executing instructions, each instruction in a user program would be fetched, decoded, and executed by a software interpreter.
NOTE: Interpreter (computing) In computer science, an interpreter is a computer program that directly executes, i.e. performs, instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program.
Before each instruction is executed, the interpreter could check to see if the process had permission to do the operation. The interpreter could allow all legal operations while halting any application that overstepped its bounds.
Now suppose we want to speed up our hypothetical simulator. Most instructions are perfectly safe, such as adding two registers together and storing the result into a third register. Can we modify the processor in some way to allow safe instructions to execute directly on the hardware? To accomplish this, we can implement the same checks as in our hypothetical interpreter, but we do so in hardware rather than software. This is called dual- mode operation.
Hardware support to differentiate between at least two modes of operations, mode bit added to computer hardware to indicate the current mode.
user mode: execution done on behalf of a user (single bit in the processor status register = 0)
kernel mode: execution done on behalf of operating system (single bit in the processor status register = 1)
In user mode, the processor checks each instruction before executing it to verify that the instruction is permitted to be performed by that process.
In kernel-mode, the operating system executes with protection checks turned off.
Thank you for reading.
If you have any ideas or suggestions that would make my posts more absorbing and handy, just let me know.
References:
https://www.amazon.com/Operating-Systems-Principles-Thomas-Anderson/dp/0985673524/ref=redir_mobile_desktop/136-0905329-1481153?_
http://newmoderntechmedia.blogspot.am/2018/01/what-is-kernaloperating-system-in.html