Operating Systems Structures

5.0(1)
studied byStudied by 5 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/67

flashcard set

Earn XP

Description and Tags

- What are the key services of an operating system? - What are the main approaches that users, processes and other systems use to access operating system services? - What are system calls? - What are system programs?

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

68 Terms

1
New cards
what is an operating system?
provides an environment which programs execute within
2
New cards
what does the operating system provide services for?
* to programs → OS manages resources and executes programs
* to users
3
New cards
what is the logical computational hierarchy in a system
hardware is lowest → then OS → system and application programs
hardware is lowest → then OS → system and application programs
4
New cards
what are operating system services?
services that the OS provides to either help users or improve efficiency

these are 9 common classes of OS services, even if specific services differ between OS to OS
5
New cards
out of the 9 OS services, which services help the individual user?
user interface (UI)

program execution

I/O operations

file system manipulation

communications

error detection

\
\[UP IF CE\]
6
New cards
out of the 9 OS services, which ensure the system operates efficiently?
resource allocation

accounting

protection and security
7
New cards
in what scenario are services needed to ensure the system operates efficiently?
systems with multiple users can share computer resources among the users to be more efficient
8
New cards
what is the user interface (UI) service?
almost all OS have a UI:

* command line interface - text commands in specific format
* batch interface (systems can communicate, instructions written in a file and the file is executed)
* graphical user interface - a window system and I/O devices

systems can have both CLI and GUI - (FreeBSD only has command line interface- therefore has less file size overall compared to the Ubuntu devices)
9
New cards
what is the program execution service?
OS responsible for

* loading program into memory
* allocating memory
* executing program
* terminating program normally or abnormally (indicates error)
10
New cards
what is the I/O operations service?
* process may need I/O which may involve a file or an I/O device (screen)
* OS lets users control I/O since users can’t control them directly
11
New cards
what is the file system manipulation service?
* programs need to
* read and write files to directories
* create and delete
* search
* move
* view file info
* some OS can include permissions to allow or deny access
12
New cards
what is the communications service?
* OS can manage process communication (processes wanting to share information) if they are on the same computer or they are executing on different computers on the same network
* communications can be implemented using
* **shared memory** → 2 or more processes can read and write to a shared section of memory
* **message passing** → packets in predefined formats are moved between the processes and the OS
13
New cards
what is the error detection service?
* OS can detect and correct errors
* errors can occur in
* **memory hardware** - memory error or power failure
* **I/O devices** - parity error on disk, connection failure in network, no paper in printer
* **user program** - arithmetic overflow, access illegal memory location, too much CPU time
* to correct the errors the OS can
* halt the system
* terminate the error causing process
* return an error code to the process so the process can detect and self correct
14
New cards
what is the resource allocation service?
* can have multiple users / processes running concurrently and resources need to be allocated to all
* can be ^^special allocation code^^ (CPU cycles, main memory) or ^^general allocation code^^ (I/O devices) which consider different factors when allocating
* e.g. CPU-scheduling routine which considers CPU speed, number of registers etc.
* can be routines to allocate peripheral devices like printers
15
New cards
what is the accounting service?
* track which user is active, what computer resources users access and use
* useful if many users use the same machine
* useful in cloud resources, accounting to bill users, gathering statistics
16
New cards
what is the protection and security service?
* people who own information in multiuser/ networked systems want to control the information use
* one process should not be able to interfere with the OS or other processes
* ^^**protection**^^ = ensure all access to system resources is controlled + protection against external attacks (eg. DDOS)
* ^^**security**^^ = protect the system from outsiders access via user authentication, defending I/O devices from invalid access attempt
17
New cards
what are the 3 main parts of the operating system?
kernel

shell

utilities
18
New cards
what is the kernel?
where the services run in the OS (and thus where system calls occur), users and programs can’t interact here directly
19
New cards
what is the shell?
around the kernel, where the command interpreter is and where users can access services from the kernel (user accesses services though shell and not directly). interprets the commands
20
New cards
what are utilities?
helps OS provide the services that it provides
21
New cards
what are the main ways users can access the operating system services?
* command line interface (aka. command interpreter)
* graphical user interface (GUI)
22
New cards
how does a command line interface work?
the **command interpreter** eg. windows CMD (CLI) exists on the UI and allows users to directly enter commands to be performed by OS

* can be implemented in the kernel or via a special program
* CLIs are also called shells
* ^^CLI function^^ → get the user command, send it to OS and execute it e.g. manipulate files
* commands be implemented in 2 ways
* commands are built-in and the command interpreter goes to prewritten code and makes a system call
* command interpreter identifies files or programs to run with the command name
* can use shell scripting to produce useful OS programs called ^^Batch Files^^
23
New cards
what are batch files?
collections of CLI commands that run together to do different tasks (different tasks exist for windows vs. Linux machines). don’t need to be compiled and executed as the command line can interpret them
24
New cards
how does a graphical user interface work?
* is a user-friendly desktop metaphor based interface
* has mouse, keyboard, monitor
* icons to represent files, programs and actions
* various mouse actions over the objects in the interface can do actions (eg. provide info, options, execution function)
* could also be touchscreen interface for phones with gestures
25
New cards
how does a command line interface compare with a graphical user interface?
* command line more efficient and more functionality, batch files can be created for efficiency
* gui is user friendly
26
New cards
what is a system call?
* a request by a process made via an interface for a service to be performed by the kernel.
* system calls provide an interface to the OS services
* structured like functions with parameters and return values written in C and C++
27
New cards
how are system calls used during program execution?
for a program to execute the OS needs to

* load program into memory (disk space)
* run the program
* manage input and output
* terminate execution normally or abnormally (indicating error)

all these things can be managed with heavy use of system calls
for a program to execute the OS needs to

* load program into memory (disk space)
* run the program
* manage input and output
* terminate execution normally or abnormally (indicating error)

all these things can be managed with heavy use of system calls
28
New cards
what tools does an application developer use when they want to access OS services?
application programming interface (API)

run-time support system

system calls
29
New cards
what is an application programming interface? (API)
interface that allows programmers to access the kernel and *invoke system calls* on behalf of the programmer instead of directly
30
New cards
how does an API work?
* the API is accessed via a @@run-time support library@@ of code
* specifies the set of functions that are available to the application programmer including the expected parameters and return values
* the functions that the API invokes are what actually make the system calls
* eg. java, writing to a file, needs to access a service that the system provides
31
New cards
what are the most common APIs?
Three most common APIs are

* Win32 API for Windows
* POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X)
* Java API for the Java virtual machine (JVM)
32
New cards
why is using an API better for programmers than calling system calls directly?
* program portability → any system can compile and run the program as long as the same API is used
* direct system calls are detailed and difficult to manage without an API
33
New cards
what is a run-time support system/ runtime environment?
* a set of functions structured as libraries (e.g. standard c library) included with the compiler which provides a system call interface.
* different programming languages each have their own run-time support systems
34
New cards
what is a system call interface?
acts as the link between the API and the system calls made available by the OS
35
New cards
how does the system call interface work?
* the system call interface intercepts the API function calls and invokes the necessary system call for the operating system
* the OS gives each system call a @@number@@ and system call interface maintains a @@table@@ containing the system calls and their number
* SCI invokes the intended system call in the kernel and passes the needed @@parameters@@ to the system call
* SCI returns the s@@ystem call status@@ and any @@return values@@ to API
36
New cards
what does the caller need to know about system calls?
* doesn’t need to know HOW the system call is implemented as most OS interface are details are hidden by the API and are managed by the RTE


* just needs to follow the API and understand what the OS will do as a result of the call
37
New cards
what is the relationship between user application - api - system call interface - os?
USER APP → API → SYSTEM CALL INTERFACE → KERNEL (containing OS services)

\

1. user application contains the API
2. API calls system call interface
3. system call interface can make system calls to the kernal and request OS services
4. OS can return the variables as needed back to system call interface and then to API
USER APP → API → SYSTEM CALL INTERFACE → KERNEL (containing OS services)

\

1. user application contains the API
2. API calls system call interface
3. system call interface can make system calls to the kernal and request OS services
4. OS can return the variables as needed back to system call interface and then to API
38
New cards
how much information is needed when making a system call?
more information may be needed for the system call to function and not just the name of the system call

e.g.

* memory length
* source
* file variables

pass these to the OS as parameters
39
New cards
how are parameters passed to the operating system?
registers

block/ table/ stack memory
40
New cards
how are registers used to pass parameters to the OS?
each parameter is stored in a register

simplest approach, but sometimes there may be more parameters than registers available
41
New cards
how are block/table/stack memory used to pass parameters to the OS?
the block memory address is passed as a parameter into the register. parameters are pushed to a stack by the program and popped from stack by operating system.

better as does not restrict the number of parameters
the block memory address is passed as a parameter into the register. parameters are pushed to a stack by the program and popped from stack by operating system.

better as does not restrict the number of parameters
42
New cards
how to system calls differ depending on the computer?
* the names of system calls can vary


* different OS show different things/ act differently even with the same set of system calls (eg. macOS vs. Windows vs. Linux)
43
New cards
what are the 6 major types of system calls?
process control calls

file management/ manipulation calls

device management/ manipulation calls

information maintenance calls

communication calls

protection calls

\
pirates found drums in CP
44
New cards
what are process control calls?
* create() + terminate() process


* load() + execute() process
* get + set process attributes - e.g, job priority, can be used to controll a new process
* wait + signal event - waits until execution done,, can wait certain amount of time or for signalled event
* allocate + free memory - processes can lock data if it’s being shared to ensure data integrity
45
New cards
in process control calls, how does the terminateProcess() system call work?
* if terminated abnormally with error, process will memory dump and error message generated. memory dump is written to a log file and examined by a debugger - system program designed to find errors


* when terminated, OS transfers control to the invoking command interpreter.
* command line - command interpreter reads next command and the user can react
* gui - error pop up displayed
* batch system - terminate whole job and go to next one
* sometimes there is special recovery when errors happen
* error levels can be defined for error input
46
New cards
in process control calls, how does the loadProcess() and executeProcess() system call work?
* allows the command interpreter to execute a program as requested by user/ another program. loading a new program can be done in 2 ways:
* if control returns to the existing process after the loaded one has finished then memory needs to be stored about the existing one
* if the 2 process can run concurrently then a new process must be multiprogrammed
47
New cards
what are file management calls?
* create() + delete() file - system calls the file name or file attribute


* open() + close() file
* read() + write() + reposition() file
* get() + set() file attributes - including name, size
* these functions can be used to organise directories in directory structure
* other systems have move() and copy() functions
48
New cards
what are device management calls?
* processes need resources (called devices) to execute e.g., main memory, disk drives, can be physical or virtual. if available resources are allocated but if not available the process waits
* request() + release() (to free up) device
* read() + write() + reposition() device
* get() + set device attributes
* logically attach or detach devices
* if 2 processes want to access the same device (monitor, keyboard) a system call will request this service and the OS will schedule time for the I/O device
* some systems merge the system calls for device management and file management as they’re similar
49
New cards
what are information maintenance calls?
* exist to transfer information between user and os
* get + set date or time
* get + set system data (number of users)
* dump() memory for debugging
* provides time profile - time that program executes at a certain location, done using tracing facility or regular timer inturrupts
* get() + set() process attributes
* important for synchronising everything (including stuff mentioned above)
* eg. want to access internet wont work with wrong date and time
50
New cards
what are communication calls
2 models of interprocess communication -

* @@message-parsing model@@ - processes communicate by sending messages which can be passed directly or indirectly through a common mail box. better for small messages as conflicts avoided and easy to implement
* @@shared memory model@@ - processes both access regions of memory to communicate

both use different system calls
51
New cards
how do system calls work for message parsing?
* create() + delete() communication connection - must be opened for communication to happen and name of other communicator must be known (by host name/ IP address/ process name. using get_hostid()
* accept_connection()
* daemon - special system program that wait for connection, one for client and server using waitforconnection()
* send + receive messages()
52
New cards
how do system calls work for shared memory model
* sharedmemorycreate() - sharedmemoryattatch() to access regions of memory
* can read() and write() to same area but not write to same location simultaneously
53
New cards
what are protection calls?
* for protecting the access of resources provided by os
* get() + setfilepermissions()
54
New cards
what is another name for system programs?
system utilities
55
New cards
what are system programs?
programs that provide convenient environment to develop and execute programs
56
New cards
what are the different purposes of system programs?
* system programs to provide a user interface to system calls
* complex system programs eg. device drivers
57
New cards
how do system programs access OS services?
making system calls
58
New cards
what are application programs?
programs that solve common problems or perform common operations eg. web browsers, work processors, games

\
59
New cards
what is a user’s view of the operating system defined by?
* defined by the system programs and the application programs and not the system calls.
* user can have different view depending on type of UI (gui, command, batch) but the system calls that function are the same
60
New cards
what are the different types of system programs?
file management programs

file modification programs

status information programs

program language support programs

program loading and executing programs

communications programs

background services
61
New cards
what are file management programs?
programs that generally access and manipulate files and directories

* create
* delete
* copy
* rename
* print
* list
62
New cards
what are status information programs?
* programs that request, format and print information. e.g. to the terminal/ output device/ file/ display in the GUI window
* @@simple versions@@ - programs that request the date, time, amount of available memory, disk space, or other status information
* @@complex version@@ - request detailed performance info, logging and debugging information
* can also support a registry which is used to store and retrieve configuration information
63
New cards
what are file modification programs?
* programs such as text editors that can create and modify file contents stored on a disk or other device
* can contain special commands to search file content or perform text transformations
64
New cards
who are program language support programs?
* Compilers, assemblers, debuggers, and interpreters for common programming languages (such as C, C++, Java, and PERL)
* could be included in an OS or download separately
65
New cards
what are program loading and execution programs?
* Once a program is assembled or compiled, it must be loaded into memory to be executed
* can provide loaders, linkers, debuggers, etc.
66
New cards
what are communication programs?
* programs that provide the mechanism for creating virtual connections between processes, users, and computer systems
* allow users to send messages to one another’s screens, browse Web pages, send e-mail messages, log in remotely, or to transfer files from one machine to another.
67
New cards
what are background services?
* don’t see them running but if we inspect the process that are running we can see them
* includes methods to launch system-program processes at boot time
* background services can terminate after a task finishes or continue to run until system is halted
* includes daemons
68
New cards
what are daemons?
services/ subsystems/ daemons - system programs that are constantly running, eg. network daemon, process schedulers, print servers.

* a system can have multiple daemons.
* the system needs to listen to network connections to connect requests to correct daemon.
* daemons can also run important activities in the user context instead of the kernel