Note
📣 You can help to improve this repo, by giving me a ⭐star⭐ and ❤️following me❤️
- Why Study Operating Systems (OS)?
- OS Definition and Function
- Structure of a Computer System
- What Does an OS Do?
- History of OS
- Basics of OS
- OS Terminology
- Types of OS
- Modern computer consists of one or more processors, some main memory, disks, printers, a keyboard, a mouse, a display, network interfaces, and various other input/output devices. All in all, a complex system. If every application programmer had to understand how all these things work in detail, no code would ever get written. Furthermore, managing all these components and using them optimally is an exceedingly challenging job. For this reason, computers are equipped with a layer of software called the operating system.
- Simply because, as almost all code runs on top of an operating system, knowledge of how operating systems work is crucial to proper, efficient, effective, and secure programming.
- Understanding the fundamentals of operating systems, how they drive computer hardware, and what they provide to applications is not only essential to those who program them but also highly useful to those who write programs on them and use them.
- In the Computer System (comprises of Hardware and Software), Hardware can only understand machine code (in the form of 0 and 1) which doesn't make any sense to a naive user. We need a system which can act as an intermediary and manage all the processes and resources present in the system.
- An Operating System can be defined as an interface between user and hardware. It is responsible for the execution of all the processes, Resource Allocation, CPU management, File Management and many other tasks.
- The purpose of an operating system is to provide an environment in which a user can execute programs in convenient and efficient manner.
-
-
- People who are using the computer.
-
- Compilers, Databases, Games, Video player, Browsers, etc.
-
- Shells, Editors, Compilers, etc.
-
- A special program which acts as an interface between user and hardware.
-
- CPU, Disks, Memory, I/O Devices ,etc.
-
- Some basic knowledge of the structure of Computer System is required to understand how Operating System works.
- Operating system is intimately tied to the hardware of the computer it runs on. It extends the computer’s instruction set and manages its resources.
- The CPU, memory, and I/O devices are all connected by a system bus and communicate with one another over it
- A transistor is a semiconductor device used to amplify or switch electrical signals and power.
- A transistor is a binary switch and the fundamental building block of computer circuitry.
- The transistor either prevents or allows current to flow through.
- A single modern CPU can have hundreds of millions or even billions of transistors.
- An integrated circuit or monolithic integrated circuit (also referred to as an IC, a chip, or a microchip) is a set of electronic circuits on one small flat piece (or chip) of semiconductor material, usually silicon.
- On which thousands or millions of tiny resistors, capacitors, diodes and transistors are fabricated.
- In computing and computer science, a processor or processing unit is an electrical component (digital circuit) that performs operations on an external data source, usually memory or some other data stream.
- It typically takes the form of a microprocessor. Today, processors use built-in transistors.
-
Like a soul in our body keeps us alive so that the processor does in the computer.
-
- Moore's law, named after Gordon Moore, is the observation and projection via historical trend that the number of transistors in integrated circuits (IC), and therefore processors by extension, doubles every two years. The progress of processors has followed Moore's law closely.
- A processor is any component that processes commands, reads, and writes data. A CPU is a Central Processing Unit, and the main processor in a computer.
- Many different computer components, like hard drives, have processors but the CPU is the most important processor in a computer and controls everything.
- Central processing units (CPUs) are the primary processors in most computers. They are designed to handle a wide variety of general computing tasks rather than only a few domain-specific tasks.
- The CPU is a microprocessor. The microprocessor is an integrated circuit (IC) that is made up of millions of transistors. However, not all microprocessors are CPUs. There are NPUs, GPUs and APUs that remove network, graphics or audio processing from the CPU.
-
The brain of the computer is the CPU (Central Processing Unit). It fetches instructions from memory and executes them.
-
The basic cycle of every CPU is to fetch the first instruction from memory, decode it to determine its type and operands, execute it, and then fetch, decode, and execute subsequent instructions.
- The cycle is repeated until the program finishes. In this way, programs are carried out.
- All CPUs contain some registers inside to hold key variables and temporary results.
-
- Registers are parts of the CPU that can store data.
- Registers operate a little like RAM, but can’t hold as much data as RAM can, but they operate considerably faster.
-
Most Important Registers
- Accumulator (AC)
- Stores the results of calculations
- Program Counter (PC)
- Stores the address in RAM of the next instruction to be executed.
- Instruction Register (IR)
- Stores the address in RAM of the instruction to be processed
- Memory Address Register (MAR)
- Stores the address in RAM of the data to be processed
- Memory Data/Buffer Register (MDR/MBR)
- Stores the data to be processed
- I/O Address Register (I/O AR)
- Stores the address of the I/O device to be accessed
- I/O Data/Buffer Register (I/O DR/BR)
- Stores the data to be processed
- Accumulator (AC)
-
ALU(Arithmetic Logic Unit)
- The ALU is the core of the CPU.
-
ALU is responsible for performing arithmetic and logical functions or operations. It consists of two subsections, which are:
- Arithmetic Section
- By arithmetic operations, we mean operations like addition, subtraction, multiplication, and division, and all these operation and functions are performed by ALU. Also, all the complex operations are done by making repetitive use of the mentioned operations by ALU.
- Logic Section
- By Logical operations, we mean operations or functions like selecting, comparing, matching, and merging the data, and all these are performed by ALU.
- Arithmetic Section
Note: CPU may contain more than one ALU and ALUs can be used for maintaining timers that help run the computer system.
-
Control Unit (CU)
- The control unit decodes what each instruction means, and can then controls how the other components operate.
- when the control unit receives an instruction, which is just a binary number, it will then signal what the ALU and memory is supposed to do.
-
Memory
- The RAM stores both the instructions that the computer needs to perform, and the data on which to perform it.
- Buses
- All of these components are connected together by bundles of wires that are collectively known as buses. So there is a bus to carry data, another for addresses, and another for instructions.
- Input and Output
- Additionally, a computer would usually have some input and output devices that can receive external data and then output the results of the calculation. This could be something as simple as a data connection, or something more complicated such as a keyboard and monitor.
This method of putting together a computer is known as the Von Neumann Architecture. It was devised by John von Neumann in about 1945, well before any of the components that would be needed to produce it had actually been invented.
- A microprocessor is a computer processor where the data processing logic and control is included on a single integrated circuit (IC), or a small number of integrated circuits.
- The microprocessor contains the arithmetic, logic, and control circuitry required to perform the functions of a computer's central processing unit.
- The integrated circuit (IC) is capable of interpreting and executing program instructions and performing arithmetic operations.
- Microprocessor is the latest form of processor or CPU. The microprocessor is a single-chip circuit integrated with all qualities of CPU with few new circuits. Its processing speed is greater than CPU. Today all latest processor CPUs are a microprocessor.
- Processor or CPU is capable of performing all kinds of computing and arithmetic functions while microprocessor deals in BIOS & memory circuits in addition to performing all CPU functions.
- Microprocessor functions are greater than the processor. In addition to processor qualities, some graphic processor units (GPU), sound cards and internet cards are also included in it.
- Microprocessor is the latest and upgraded version of processor/CPU.
- Although microprocessor is the latest and advanced technology but still the main processing function of the computer is controlled by the processor.
- The new function of audio processing which helps in producing clear audio is stored in a sound card of the microprocessor which was previously not available in the processor.
- Due to the addition of different processors on a microprocessor, its speed is slower than the processor.
- CPUs/processors can be microprocessor but all microprocessors are not CPU.
- CPU is the main part of the computer while the microprocessor is a simple chip on the motherboard.
- A graphics processing unit (GPU) is a computer chip that renders graphics and images by performing rapid mathematical calculations.
- In the early days of computing, the central processing unit (CPU) performed these calculations. As more graphics-intensive applications were developed, however, their demands put a strain on the CPU and decreased performance. GPUs were developed as a way to offload those tasks from CPUs and to improve the rendering of 3D graphics.
- GPUs work by using a method called parallel processing, where multiple processors handle separate parts of the same task.
- GPUs are fairly similar to CPU architectures. However, CPUs are used to respond to and process the basic instructions that drive a computer, while GPUs are designed specifically to quickly render high-resolution images and video. Essentially, CPUs are responsible for interpreting most of a computer's commands, while GPUs focus on graphics rendering.
- Memory is the electronic holding place for the instructions and data a computer needs to reach quickly. It's where information is stored for immediate use. Memory is one of the basic functions of a computer, because without it, a computer would not be able to function properly.
- There are technically two types of computer memory: primary and secondary. The term memory is used as a synonym for primary memory or as an abbreviation for a specific type of primary memory called random access memory (RAM). This type of memory is located on microchips that are physically close to a computer's microprocessor.
- When a program is open, it is loaded from secondary memory to primary memory. Because there are different types of memory and storage, an example of this could be a program being moved from a solid-state drive (SSD) to RAM
- Memory is volatile, which means that data in memory is stored temporarily. Once a computing device is turned off, data stored in volatile memory will automatically be deleted. When a file is saved, it will be sent to secondary memory for storage that are non-volatile.
- The memory system is constructed as a hierarchy of layers.
- The top layer consists of the registers internal to the CPU. They are made of the same material as the CPU and are thus just as fast as the CPU. Consequently, there is no delay in accessing them. The storage capacity available in them is typically 32 × 32 bits on a 32-bit CPU and 64 × 64 bits on a 64-bit CPU. Less than 1 KB in both cases. Programs must manage the registers (i.e., decide what to keep in them) themselves, in software.
- Cache memory, which is mostly controlled by the hardware. Main memory is divided up into cache lines, typically 64 bytes, with addresses 0 to 63 in cache line 0, 64 to 127 in cache line 1, and so on. The most heavily used cache lines are kept in a high-speed cache located inside or very close to the CPU. When the program needs to read a memory word, the cache hardware checks to see if the line needed is in the cache. If it is, called a cache hit and else, cache miss.
- Cache hits normally take about two clock cycles.
- Cache memory is limited in size due to its high cost. Some machines have two or even three levels of cache, each one slower and bigger than the one before it.
- Types of Cache
- Primary Cache
- A primary cache is always located on the processor chip. This cache is small and its access time is comparable to that of processor registers.
- Secondary Cache
- Secondary cache is placed between the primary cache and the rest of the memory. It is referred to as the level 2 (L2) cache. Often, the Level 2 cache is also housed on the processor chip.
- Primary Cache
- Main memory is the primary, internal workspace in the computer, commonly known as RAM (random access memory). Specifications such as 4GB, 8GB, 12GB and 16GB almost always refer to the capacity of RAM. In contrast, disk or solid state storage capacities in a computer are typically 128GB or 256GB and higher
- Magnetic storage or magnetic recording is the storage of data on a magnetized medium. Magnetic storage uses different patterns of magnetisation in a magnetizable material to store data and is a form of non-volatile memory. The information is accessed using one or more read/write heads
-
-
An interrupt is a signal to the processor emitted by hardware or software indicating an event that needs immediate attention. Whenever an interrupt occurs, the controller completes the execution of the current instruction and starts the execution of an Interrupt Service Routine (ISR) or Interrupt Handler.
-
- Program
- Generated by some condition that occurs as a result of an instruction execution, such as arithmetic overflow, division by zero, attempt to execute an illegal machine instruction, or reference outside a user's allowed memory space.
- Timer
- Generated by a timer within the processor. This allows the operating system to perform certain functions on a regular basis.
- I/O
- Generated by an I/O controller, to signal normal completion of an operation or to signal a variety of error conditions.
- Hardware Failure
- Generated by a failure such as power failure or memory parity error.
- Program
-
- Operating System is a well-organized collection of programs that manages the computer hardware. It is a type of system software that is responsible for the smooth functioning of the computer system.
- In the 1970s, Batch processing was very popular. In this technique, similar types of jobs were batched together and executed in time.
- This type of operating system does not interact with the computer directly.
- In Batch operating system, access is given to more than one person; they submit their respective jobs to the system for the execution.
- The system put all of the jobs in a queue on the basis of first come, first serve and then executes the jobs one by one. The users collect their respective output when all the jobs get executed.
- The purpose of this operating system was mainly to transfer control from one job to another as soon as the job was completed.
- A Multiprogramming Operating System runs multiple programs on a single processor.
- Multiprogramming is an extension to batch processing where the CPU is always kept busy. Each process needs two types of system time:
- CPU time
- I/O time
- In a multiprogramming environment, when a process does its I/O, The CPU can start the execution of other processes. Therefore, multiprogramming improves the efficiency of the system.
- In Multiprocessing, Parallel computing is achieved. There are more than one processors present in the system which can execute more than one process at the same time. This will increase the throughput of the system.
- The multitasking operating system is a logical extension of a multiprogramming system that enables multiple programs simultaneously. It allows a user to perform more than one computer task at the same time.
- While a multiprogramming operating system allows more than one program to run simultaneously using a single CPU, a multitasking operating system allows multiple processes or tasks to be executed at the same time utilizing multiple CPUs.
- In preemptive multitasking, the operating system can initiate a context switching from the running process to another process. In other words, the operating system allows stopping the execution of the currently running process and allocating the CPU to some other process.
- In cooperative multitasking, the operating system never initiates context switching from the running process to another process. A context switch occurs only when the processes voluntarily yield control periodically or when idle or logically blocked to allow multiple applications to execute simultaneously. Also, in this multitasking, all the processes cooperate for the scheduling scheme to work.
- An Operating system, which includes software and associated protocols to communicate with other computers via a network conveniently and cost-effectively, is called Network Operating System.
- In this type of operating system, network traffic reduces due to the division between clients and the server.
- This type of system is less expensive to set up and maintain.
- In this type of operating system, the failure of any node in a system affects the whole system.
- Security and performance are important issues. So trained network administrators are required for network administration.
- In Real-Time Systems, each job carries a certain deadline within which the job is supposed to be completed, otherwise, the huge loss will be there, or even if the result is produced, it will be completely useless.
- The Application of a Real-Time system exists in the case of military applications, if you want to drop a missile, then the missile is supposed to be dropped with a certain precision.
- Easy to layout, develop and execute real-time applications under the real-time operating system.
- In a Real-time operating system, the maximum utilization of devices and systems.
- Real-time operating systems are very costly to develop.
- Real-time operating systems are very complex and can consume critical CPU cycles.
- In the Time Sharing operating system, computer resources are allocated in a time-dependent fashion to several programs simultaneously. Thus it helps to provide a large number of user's direct access to the main computer.
- It is a logical extension of multiprogramming. In time-sharing, the CPU is switched among multiple programs given by different users on a scheduled basis.
- A time-sharing operating system allows many users to be served simultaneously, so sophisticated CPU scheduling schemes and Input/output management are required.
- Time-sharing operating systems are very difficult and expensive to build.
- The time-sharing operating system provides effective utilization and sharing of resources.
- This system reduces CPU idle and response time.
- Data transmission rates are very high in comparison to other methods.
- Security and integrity of user programs loaded in memory and data need to be maintained as many users access the system at the same time.
- The Distributed Operating system is not installed on a single machine, it is divided into parts, and these parts are loaded on different machines. A part of the distributed Operating system is installed on each machine to make their communication possible. Distributed Operating systems are much more complex, large, and sophisticated than Network operating systems because they also have to take care of varying networking protocols.
- The distributed operating system provides sharing of resources.
- This type of system is fault-tolerant.
- Protocol overhead can dominate computation cost.