top of page

Operating Systems Basics

Tutoring Operating Systems and Networks > Network Concepts

​An operating system (OS) is software that manages computer hardware resources and provides services to computer programs. As you can see from the diagrams below, it basically controls everything that happens in a computer.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CPU

The central processing unt (CPU) is responsible for logical data handling and input/output (I/O) operations from and to the outside world.

If a computer has more than one CPU, this is called multiprocessing.

A CPU has 2 modes: 

  1. Kernel mode - the CPU can execute any of it's instruction set and has complete access to the hardware. This would be dangerous in the hands of a typical computer user as they might do something critical to the system without meaning to.

  2. User mode - User programs run in this mode. User mode only allws a subset of instructions and a subset of hardware features.

 

GPU

The graphics processing unit (GPU) is an electronic circuit specialised for graphics processing. The GPU can either be in the form of a graphics card, integrated into the motherboard chipset or in the CPU itself.

Due to the highly parellel nature of the GPU, it is very efficient at processing large blocks of data that are processed in parallel, more-so in fact than a general purpose CPU.

 

The Fetch, Decode, Execute cycle

Before a program does anything, it is loaded onto the main memory (primary memory) of the computer (Random Access Memory or RAM). The program is loaded along with any data that the program will be working on.

 

1. Fetch

  • The CPU has internal memory called registers, which it uses to store the data and instructions to be performed. It fetches these from the RAM.

  • The CPU places the memory address of the next instruction to be fetched onto the address bus.

  • Data from this address is then sent back to the CPU via the data bus. 

  • A bus is a hardware pathway connecting components together to transfer data between them.

 

2. Decode

  • The CPU now interprets a specific "instruction set" (decoded) and prepares itself for the next set. Each type of CPU has a different instruction set and cannot understand one meant for another. For example, an Intel i7 chip cannot understand ARM instructions.

 

3. Execute

  • The instructions are executed on the data and the result is stored on yet more registers.

  • The CPU now prepares itself for another fetch-decode-execute cycle.

 

Memory

The memory is an array of bytes. Each byte contains 8 bits and might look like this : 01001001

  • Primary memory is what the CPU uses to access data and information. RAM temporarily stores these and makes them available for work by the CPU.

  • Secondary memory is for storage, and the data is retained when the computer is switched off.

 

Memory can be accessed at different speeds, for example, it takes less time for memory from the registers to be accessed than from a hard disk.

Memory management is very important in computer science, everything a programmer does requires considering how much memory will be taken up. Poor memory management can lead to bad and sometimes critical things happening to a computer so operating systems are careful to manage memory in the best way they can (usually).

 

Hardware and peripherals
  • Hardware may trigger an interrupt at any time by sending a signal to the CPU. An interrupt basically stops the CPU executing the curent thread and makes it do something else by shifting it's execution onto what is needed or requested. 

  • Devices react with the CPU via device controller connected with common buses. 

  • Operating systems hava a device driver for each device controller. Device drivers are software that controls hardware devices. A device is just a component of computer hardware, so a mouse, a keyboard or any other physical component. Software is the non-tangible computer programs that run on the hardware.

bottom of page