Software Development
Memory Management
It is important to manage computer memory at the system level. The quantity of memory can be vastly different depending on the type of computer being considered. Example: a processing chip in a chip and pin credit card or similar commercial card will have a tiny amount of memory to hold encrypted data A supercomputer will have petabytes of Memory to manage (1 million GB)
Device Drivers
Every piece of hardware will have a device driver that allows the operating system to control and communicate with it. The could be hundreds of drivers pre-installed with the operating system, and the right ones for that particular computer are loaded on boot up. In windows the device drivers are kept in files called the registry. In Linux they are known as configuration files. Device drivers for printers, scanners, tablets, cameras etc will be different for different operating systems.
Process State
Every process has a small data area allocated to it called the process control block (PCB). This is located in the data segment of the operating system's kernel. The block provides the CPU and scheduler with the details needed to manage that process
Problems with Interrupts
There are interrupts have two problems: Responding quickly enough (latency) A real time car computer will be dealing with thousands of interrupt requests per second as the engine, brakes, throttle etc all demand attention Too many interrupts (stack overflow) What happens when the stack is full because so many interrupts are waiting their turn to run? The answer is a stack overflow that usually crashes the computer. Sometimes a simple polling system is the way to go for low demand situations.
Batch Operating System
A batch is the name given to a task of doing the same job over and over again, the only difference being the input data presented for each iteration of the job. This is common on a mainframe computer Example: a mainframe set up to process 30 million pension statements, each one calculated for a specific person. A mainframe is a very large computer capable of handling and processing large amounts of data quickly. Used by large organisations.
Memory Crash
A crash is the sudden failure of a software application or operating system or of a hardware device such as a hard disk .
Distributed System
A distributed operating system manages a group of distinct computers and makes them appear to be a single computer. The development of networked computers that could be linked and communicate with each other gave rise to distributed computing. Distributed computations are carried out on more than one machine. When computers in a group work in cooperation, they form a distributed system Example: The internet
Memory Leaks
A memory leak is the gradual loss of available computer memory when a program (an application or part of the operating system) repeatedly fails to return memory that it has obtained for temporary use.
Disk Partitioning
A personal computer has various different drives available for you to access. E.g. C drive or D,E,F drives. My computers also have a 'recovery drive' which is intended to reprogram the computer back to factory settings should a serious problem occur in the main drive. These drives are created by splitting up your hard disc into logically separate parts called partitions. This process is called Disk partitioning. Logically separate means that even though the hard disk is one piece of hardware, the operating system will treat each partition as separate entities and each partition will contain its own files etc. You can partition your disk with specialist software. Example: With a 500gb hard drive, you could allocate 50gb to drive C for the operating system, 150gb to drive D for installed applications. The remaining 300gb could be used to store various different documents and data.
Process
A process is a program loaded into memory that can be executed by the CPU. They are known as 'Jobs'. A process can be 1 of 3 states: Its code is running within the CPU It is waiting for a resource to become available(.disk file) It is ready to run but not currently active in the CPU
Stack Overflow
A stack overflow is an undesirable condition in which a particular computer program tries to use more memory space than the call stack has available. In programming, the call stack is a buffer that stores requests that need to be handled.
Bios Booting Stage 2
After the POST has been completed, the BIOS will initialise the video card so that you can begin to see things on the screen. It will usually begin with the maker's start up screen (i.e. Dell, Lenovo etc.) It will look for peripherals such as hard disk and signals it to start up. Other peripherals such as RAM and CD drives, speakers etc are also started up. It then looks for a bootable drive after the hardware has been set up to boot an OS
Why memory needs to be managed
All memory is limited so it needs to be managed. This is the task of the memory manager which is part of the operating system.
Operating Systems(OS)
An OS is system software that manages computer hardware and software resources and provides common services for computer programs. It manages hardware, user interface and all other software running on that computer.
Types of Interrupt
An interrupt stops the CPU from what it is doing and starts doing something else. Some Interrupts are more important than others. So therefore there is a hierarchy of interrupts.
Bios Booting Stage 3
Boot sector - is the first region of storage that the computer will read on a specified hard disk. Instructions on how to boot the drive are contained on this. Master Boot Record - this is a data table indicating where the partitions are located on a particular hard disk. The CPU needs to know this because it needs to jump to the boot sector before it can carry on. Primary Partition - the master boot record point the CPU to this. This contains the OS. The CPU will now execute the code in the boot sector of the primary partition. Boot loader - will start to load the OS kernel into memory. Then other various drivers are loaded into memory. Finally the graphical user interface is loaded with all personal settings.
System Boot
Booting allows the operating system to be loaded when you switch on your computer. Booting has to happen in small steps because at the point of switch on, the machine is effectively useless. It does not know about any hard disks it may contain, or any peripherals such as the screen keyboard or mouse.
Segmentation and Paging Similarities
Both techniques involve splitting up primary memory into smaller sections Both techniques make maximum use of RAM Segmentation involves loading programs to memory. It is possible to load only part of the program into primary memory and this part then calls up whatever extra code is required at that point in time. For example, Dynamic link Libraries (DLL) can reside on the hard disk until called up into main memory by an executing program Paging is trying to optimise the use of RAM by dumping unused pages onto the hard disk as virtual memory. In both cases only part of the code needs to running in RAM. Pages don't need to be next to each other. I.e. The starting address for a page 905 will not necessarily be right next to the starting address of page 906. Similarly, program segments can be broken up into non-contiguous (not next to each other) memory addresses. It is the job of the memory manager to make it appear to the OS as if they were contiguous.
How interrupts work
Each interrupt has a corresponding 'interrupt service routine'. This is a set of instructions that have to be carried out when the event occurs. Interrupt service routine example - Mouse: 1. Mouse moves 2. Hardware chip on the motherboard, called the interrupt controller detects the mouse signal 3. The interrupt controller issues an interrupt signal and sends it to the CPU 4. The CPU receives the signal 5. An exact copy of all the registers in the CPU at that moment in time is then stored in the STACK on primary memory(allows CPU to return to it) 6. CPU executes the mouse interrupt 7. CPU tells the graphics card to repaint the screen cursor to respond to where the new mouse position is 8. CPU then reloads its registers and continues with what it was doing
Bios Safe Mode
If there is a problem with the OS set up, (maybe a corrupt device driver is being loaded that prevents the system from loading properly), the boot loader will load the operating system in safe mode. This means that is has loaded a stripped down version of the operating system that only contains a minimal set of device drivers and the screen is set to a low resolution so even the simplest monitor can display it.
Process 2.0
In a multi programmed environment, many applications will run on the computer, so there will be many processes in memory. The scheduler is split into three parts: Low level scheduler - moves the process at the front of the ready queue into the CPU so it can start running. High level scheduler - loads jobs into the ready queue. Medium level scheduler - moves jobs between primary and secondary memory.
Disk Thrashing
In computer science, thrashing occurs when a computer's virtual memory subsystem is in a constant state of paging, rapidly exchanging data in memory for data on disk, to the exclusion of most application-level processing. This causes the performance of the computer to degrade or collapse.
Shortest Time Remaining
In this algorithm, the scheduler estimates how long each process will take. It then picks the process that will take the least amount of time and runs that. If a job is added with a shorter remaining time the scheduler is switched to that one.
What is an interrupt
Input/Output devices need to be handled as and when they need attention. One method of doing this is for the CPU to keep checking with the device to see if it needs attention. This is called 'Polling'
Virtual Machines
It is possible to write a program that has the same functionality as a physical computer. These are known as virtual machines. It emulates dedicated hardware. The user has the same user experience on the virtual machine as they do on a physical machine. A common use of virtual machines is to run operating systems within another operating system. This might be because a program is needed that will not run on the host operating system. You can also test a program being developed on multiple platforms with a virtual machine
Features of an OS 2.0
Managing input/output - data and applications are stored on secondary storage devices such as hard discs, optical drives etc when not in use. The operating system has a file management system that allows the user to organise their files (move, copy, delete). Handling network communication - data packets travelling to and from computers on a network are handled by the OS. Scheduling - handles how active processes are making efficient use of the CPU processing cycles.
Features of an OS
Memory management - the OS has to ensure that applications are able to run in the amount of memory available and that they do not interfere with one another. Resource allocation - OS will provide a working area for each user. This includes Disc space, a personal GUI, printer output they are allowed, how high a priority they can assign a job Data and user security - each user has to be authenticated with a username and password. Data and files are kept private from other users unless they choose to share files.
Device Drivers
Operating systems are expected to communicate with a wide variety of devices, each with different model and manufacturers. It would be impossible for the makers of operating systems to program them to handle all existing and future devices. This is why we need device drivers. A device driver is a piece of software, usually supplied with a device, that tells the operating system how it can communicate with the device.
Polling
Polling will keep nagging any input/output devices to see if they need any attention. This works but is inefficient as it wastes a lot of time and effort. A better way to approach this is for the CPU to wait for a message as to when the input/output needs attention. This is known as interrupt method.
Virtual Memory
Primary memory has a limit. There is a trick that the memory manager can use to fool the operating system into thinking that there is more primary memory than is actually physically present. This is called virtual memory Virtual memory is making use of secondary memory as if it were main memory, therefore acting as an extension of primary memory.
Primary Memory
Primary memory is main memory used to execute program code and store temporary data. Primary memory is physically made up of RAM which is volatile memory. Software which is being processed by the CPU is temporarily stored in main memory. A typical computer will have between 1 - 4 Gigabytes of RAM outside the main CPU. The CPU also contains volatile memory in the form of registers and cache.
Secondary Memory
Secondary storage is non volatile storage. For example the hard disk, flash memory, magnetic tape. Secondary memory is used to hold data and programs which are currently not being used, but need to be accessed at some point. A typical personal computer will have a few hundred gigabytes of secondary memory in the form of a hard disk.
Round Robin Scheduling
Round-robin (RR) is one of the algorithms employed by process and network schedulers in computing. As the term is generally used, time slices are assigned to each process in equal portions and in circular order, handling all processes without priority (also known as cyclic executive). Downside of round robin is that it takes no account of job priority. For urgent jobs, round robin is not the best approach to take.
Segmentation and Paging Differences
Segments may be of variable size, pages are fixed Pages are smaller than segments Computer performance isn't affected by non-joining Pages. However, segments prefer to be in one piece within memory for performance reasons. If a segment is not in one piece, then the memory manager has to work harder to manage the application.
Shortest Job First Scheduling
Shortest job first is a scheduling algorithm in which the process with the smallest execution time is selected for execution next. Shortest job first can be either preemptive or non-preemptive.
Process State 3.0
Status: Indicates if the process is Running, Waiting (Blocked), or Ready Registers: A copy of all the CPU registers when the process last ran in the CPU. These will be re-loaded into the CPU when the process is ready to run Units of processing time: Lets the scheduler know how much time the process has had to run so far. Awaiting resource: If the process is in the WAITING / BLOCKED state, it identifies which resource the process is waiting for. In this case the process is waiting for a keyboard input. Link to other PCB: A queue is a kind of list data structure. Lists are easily handled if each item in the list can point to the next one.
Process State 2.0
The Owner ID identifies who is running the process. If there is a problem, or the process needs to be paid for once it is finished (on a mainframe / supercomputer), this item identifies the user. Current Priority: This is a number indicating the relative importance of that process, used by the scheduler to decide which is the next process to be allowed to run. The scheduler can initially set the priority based on what is currently happening in the system. Users with the right permissions on certain operating systems e.g. Unix, can also change the priority of their processes.
Bios Booting Stage 1
The bios does some basic system checks. These checks are called POST (Power On Self Test) and they include: System memory is okay System clock/timer is running Processor is okay Keyboard is present Screen display memory is working BIOS is not corrupted. This all happens very quickly. If there is a problem the BIOS will emit beeps from the internal speaker or motherboard itself.
Networking Operating System
The computers in this school are part of a network. Most companies use networked operating systems. All these machines need to have an operating system that can deal with the network.
Shortest Burst
The idea of this approach is to get as many jobs through the CPU as possible. Many processes spend some time waiting for an input/output event - they then run for a bit and once again they have to wait for another input/output event. The processing and then waiting time between events is known as the 'burst time' This scheduler schedules jobs with the shortest burst time to run first.
Memory Management 2.0
The memory manager needs to allocate memory to programs and processes that demand to be run at the same time. These processes need to be protected from one another so that they do not write over each other. The memory manager will not allow one program to affect the running of another program. It will keep each process entirely separate so that the OS can load and unload applications without any problem. This is data security. The memory manager should allow many applications to run at the same time. To do this it needs to allow applications to share memory.
Context Switching
This is the jumping of instructions from the current CPU operations to the interrupt service routine and then back again.
Scheduling
This is when the operating system allocates resources in a timely manner to each process that needs to run.
Networking Operating System 2.0
There may be many users that use the same computer, so your operating system is responsible for creating 'user folders' on the lock hard disk to store their particular settings and application set ups. When a user logs on to the computer, the OS will read the settings from the correct username folder and set up the desktop to look just how they last left it along with all the settings they chose for various applications.
Interrupts
These are useful as rather than continually polling the interrupts for changes as soon as an event happens the CPU is interrupted from what it is currently doing and takes a snapshot of all registers in the CPU. The process that happens as a result of the interrupt is called the Interrupt Service Routine (ISR).
Paging
This is where relatively inactive pages are temporarily removed from physical memory and placed into virtual memory. Paging happens when main memory is getting a bit fill. The memory manager will look at pages in main memory and identify those that haven't been used in a while. They will be moved to virtual memory. When an application needs data held on a page in virtual memory, it will be swapped back into main memory and another inactive page will take its place.
Multi-User, Multitasking
This can be found in main frame and Supercomputers. They are highly sophisticated and designed to handle many people running their programs on the computer at the same time. The operating system now has to manage: -Each user logged on to the system -Allocate resources to the jobs they want to run -Keep logs of how much processing -Time and resources they use -Work out most efficient use of cycles -Maintain security
Priority Scheduling
This form of scheduling takes into account of the relative priority of the jobs in the queue. Process 1 will be completed before process 4 because it has a higher priority. This approach is food for making sure the most vital jobs get to run first. However, the scheduler needs to also take into account low priority jobs.
Kernel
This has the task of loading applications into memory, ensuring that they do not interfere with one another and allowing them to share use of the CPU efficiently. The kernel of each operating system is design with different duties in mind. The kernel handles file storage to and from secondary storage devices such as hard disks and optical drives. It handles: -Loading/unloading applications from memory -Scheduling tasks to run on the CPU -Memory management -File management -Data security
Deadlock
This is a situation where processes have effectively locked themselves out because they are all waiting on each other to do something.
Real Time Operating System
This is found in system which aim to control a series of actions by using a computer. An engine management computer in a car has micro-second control of the engine and exhaust system. It has dozens of rapidly changing inputs that need to be processed to produce an output. Real time does not always mean fast. For example, a traffic light computer has a real time operating system that only needs to react within seconds. A braking system in a car on the other hand would need to reach in micro-seconds.
First Come First Served
This is like queuing in a shop. The first process to arrive to the CPU is dealt with by the CPU until it is finished; meanwhile, any other processes that come along are queued up for their turn. This takes a lot of time to deal with each process in turn.
User Interface
This part of the operating system is directing what you see on the screen and reacting to your key presses and other inputs. The user interface could be a basic command line interface, as you may find on a server, or it might be a full blown graphical user interface.
Bios
This stands for Basic Input/output system. When a computer is first switched on it looks to the BIOS to get it up and running, and so the processor's program counter points to the BIOS's memory. The BIOS will usually first check the computer is functional, memory is installed and accessible and the processor is working. THIS IS CALLED THE POWER-ON-SELF-TEST Once it has completed this it will use a boot loader program to load the operating system's kernel into memory. The BIOS is usually stored on flash memory so that it can be updated. This also allows settings such as boot order of disks to be changed and saved for later.
Single User, Multitasking
This type of operating system is within a personal computer. It is designed mainly with a single user in mind but can deal with multiple applications running at the same time. Memory available is also very different It will have Gigabytes of RAM to allow For multiple applications to run.
Single User, Single Application
This type of operating system only has to deal with one person at a time, - it runs one user application at a time. Examples include a basic mobile phone or mp3 player -Only one user can use the device -Only one application can run at a time
Multi-Level Feedback Queues
This uses a number of queues Each of these queues has a different priority The algorithm can move jobs between these queues depending on the job's behaviour
Paging Management
To manage these pages, a 'Page table' is created by the memory manager which stores the starting address of each page. The starting address is where the first byte of each page is physically located in memory. Paging is possible because the memory manager divides primary memory into sections of equal size - called pages. The pages are efficiently set to be the same size as the sectors of the hard disk. A page can be as little as 512 bytes or as large as 64kb or more.
Segmentation
To summarise a segment will contain: Code segment, where the program code is stored Data segment, where variables defined by the code are stored whilst the program is running Stack segment, starts from the top of the segment and grows downwards. The stack is used by sub routines and interrupts to hold temporary data and addresses. A subroutine is a sequence of program instructions that perform a specific task. An interrupt cause the main program to stop and figure out what to do next.
Virtual Machines Advantages
Virtual machines have advantages over physical machines because they are just programs and data. They can be backed up and duplicated and more than one can be run at one time on a physical machine. Many organisations are virtualising their network infrastructure, making their servers a group of virtual machines running from a cluster of physical machines. Intermediate code (on a virtual machine) allows for code to be highly portable. As hardware becomes cheaper and more powerful, virtual machines are likely to become more common.
Multi-User Scheduling
When a program is being executed in memory this is called a process. You have many people using the same process at a time. Each person is running a thread of this process Programmer 1 wants to compile source code. The OS will load the correct compiler to memory as a process and set up a single thread for Programmer 1 to use it Programmer 2 wants to do the same. The OS knows a compiler is already in memory so it assigns another thread for Programmer 2 the same time as Prog 1. This is known as Scheduling