ikt-102_operativsystemer_20231214230226 Flashcards
(232 cards)
What is an operating system?
An operating system is a software that runs in the kernel, and defines a set of standard interface rules, provides services, and acts as a common platform for applications and devices to interface with. It is the interface between machine hardware and user applications, it is a collection of system programs that control system activities, and it defines the rules for these interactions. It allocates available resources and can give user limited access to those various resources.| Interface rules, services, machine hardware, user applications, system a
- Q: What two ways are resources allocated in operating systems, what is this called?
Resources are allocated in two ways, either in time (the CPU), or in relation to space (RAM/Disks). This is called multiplexing.| Time, Space
- Q: (OPERATING SYSTEM) What are the main functions of an operating system?
- Common Platform- Interface: Hardware <-> User Applications- Coordinate all activity- I/O- Memoryignorer når du pugger:The operating system is supposed to be a common platform between hardware devices, software, and various compatible user applications. As a common platform, the only thing you have to worry about as a consumer or programmer is if the software or hardware is compatible with an operating system.Firstly, it is to administrate and coordinate all activities, and to resolve conflicts wherever they arise. Furthermore, to keep track of files, and to handle all I/O activities, as well as managing memory. Secondly, it is to establish a common platform for user applications to run in, a simple interface between hardware and user applications.| Common platform, coordinate all activities
- Q: (OPERATING SYSTEM) What is an extended machine?
- A way of viewing operating systems function* Abstraction* Interface between Machine Hardware & User ApplicationsExtended machine is a way of viewing operating systems. As an extended machine operating systems are supposed to create an abstraction of the underlying hardware for system resources and users to interface with. This is because the underlying hardware can be extremely complex, and it serves everyone’s best interest if the operating system handles hardware.| Extended machine, abstraction, interface
- Q: What is an example of an abstraction the operating system makes?
An obvious example of an abstraction is the file system. Hard drives are extremely complicated, and to make them usable by people and programmer’s abstractions are necessary.| File system
- Q: (OPERATING SYSTEM) What is a resource manager?
Resource manager is a way of viewing the operating system. As a resource manager the system is tasked with allocating system resources where they are needed. In order to do this the OS has to keep track of what resources are used and by what processes they are being used at all times, furthermore, to decide who should get the resources next, and to resolve conflicts between processes.| Resources, tracking resource usage, resolving conflicts, scheduling
- Q: (OPERATING SYSTEM) What is multiplexing?
Multiplexing means sharing of resources, this can be done in time and space. In time multiplexing we mean that resources are shared based on time used, such as the CPU. In space multiplexing we mean resources that are shared are shared between many programs, e.g., RAM or storage| Sharing resources, time, space
- Q: What is a System Call?
As an extended machine, the operating system hides the complex underlying operations through services, and in order for programs to access such services they have to initiate a system call, notifying the operating system of their request.explanation:To understand what System call is, we need to understand that the computer runs in two modes, User mode and Kernel mode. Behind kernel mode are many services and routines that are restricted from user mode processes to use. Thus, if a user mode process needs to use a service or routine in kernel space, it must make a system call to let the operating system know this.Then, the operating system will trap this process, and take control of it. Now in kernel mode, The OS will read the parameters and then proceed to do the job. When the job is complete, the OS hands back control to the process and it returns to user mode.| service, access to services, request
- Q: Give some examples of system calls.
There are many kinds of system calls, in POSIX-compliant systems some of them are:- open (initializing access to file)- read (access data in a file stored in the file system)- write (writes data from buffer to a device, e.g., a file)- exit (a process terminates itself after completing work)- kill (a command that sends a signal to a process, requesting it to exit)| open, read, write, exit, kill
- Q: Why are system calls necessary?
System calls are necessary because some of the available services operating systems provide must run in kernel mode. Thus, if a user application wishes to make use of a system call like that, it must make a system call, and from there the operating system will run the part of the program that needs to be in kernel mode, when the job is complete the OS hands back control to the user application.Explanation:System calls are necessary because the OS runs in two modes, user and kernel mode. So, the question is really why are there these two modes? It is to act a safeguard against processes performing harmful operations they should not be doing, such as accidentaly reading or writing to files they have no bussiness interacting with.| services, kernel mode
- Q: What is POSIX?
Portable Operating System IX, POSIX, is a standard for UNIX systems that was developed by the IEEE Standards Board. It is notable for its success in establishing an industry standard, where many attempts before it had failed. The goal of POSIX was to make it easier for programmers to write UNIX programs that are compatible with any UNIX system. Before POSIX, there were many variants of UNIX, which was a challenge for programmers who had to adapt their code to each one if they wanted part of that market share. As this was seen as unsustainable, a standardization was necessary. POSIX version 1003.1 standardizes system calls. Later, a version** 1003.1c came which standardizes threads**.| Easier to write programs for UNIX systems, before many variants
- Q: What is multiprogramming?
Multiprogramming is essentially when more than one program is held in memory concurrently, ready to run whenever they are allocated CPU time again. This feature makes better use of the CPU, since instead of waiting for a program to complete some I/O operation, it can immediately go to work on another program.| concurrent running programs, makes better use of CPU
- Q: What makes multiprogramming possible?
Multiprogramming works due to the great speed difference between the CPU operations as compared to the I/O operations. Typically, CPU operations are 1000 times faster than I/O operations.| Speed difference, 1000 times faster operations
- Q: Explain user mode and kernel mode
A computer runs in two modes, user mode and kernel mode. The operating system runs in kernel mode, where it has full access to all instructions the hardware is capable of running. User mode programs and applications have limited access to such instructions and have no access whatsoever to instructions that can control the machine itself or I/O devices.| user mode, kernel mode
- Q: What happens during a system call?
- An application needs access to a service. However, this service is restricted to kernel mode2. The application makes a system call, which the operating system receives3. The OS takes control of the program, and reads the instruction and parameters4. The OS locates the relevant service routine and completes the job5. The OS returns control back to the program
- Q: Talk about kernel mode
Kernel mode is fully controlled by the operating system. Kernel mode acts as a safeguard against applications making illegal operations, such as overwriting files.
What items do processes have?
Processes will each have an address space with its own program text and data, as well as its own logical program counter, registers, variables, and other resources, such as: open files, child processes.
What is a process?
The process is an instance of a running program and is a clever way of grouping related resources together.| Running program, address space, group resources, program counter
What benefits are there to processes?
- Processes are the foundation of modern computing- Enable multiprogramming - Increases efficiency and speed of programs- Schedulers make it possible to manage a lot of activity within a computer system| manage activity in computer, scheduler
Are programs and processes the same thing?
No, despite being similar, processes and programs are quite different. The program is essentially the recipe, and the processes is the activity of creating whatever the recipe describes. In essence, the process is a running instance of a program, and a program is a passive recipe for the process to follow.| program = recipe, process = activity
How are processes created?
Processes are created by:system initialization, other processes, and a user request. In every case a system call is executed, calling on the operating system to create a process and run it in the indicated program.| system initialization, other processes, user request, system call
Why are processes terminated?
Processes will eventually end, and this can happen for a number of reasons. - Completed work.- Killed by another process- Error exit (encounters bug)- Fatal Error (causes the bug)The most obvious would be that a process has completed its work. At that point the compiler would then execute a system call, letting the operating system known to terminate the processSome processes can be killed by other processes. Other reasons are error exit, and fatal error. Error exit happens when a process encounters an error, announces just that, and exits. Fatal errors happen when the process itself causes the error, due to a bug in the program.
How are processes terminated?
Processes are usually terminated by the operating system. A system call is made, requesting that the operating system terminates a process, for whatever reason.| complete work, other processes, error exit, fatal error
What enables multiprogramming with processes?| States
Processes are essential for multiprogramming environments with parallel processing. To make this possible, processes have states which may be saved.