🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Document Details

LuxuryAbundance

Uploaded by LuxuryAbundance

Algonquin College

Tags

operating systems user interfaces computer science

Full Transcript

Operating System Services Operating systems provide an environment for execution of programs and services to programs and users One set of operating-system services provides functions that are helpful to the user: – User interface - Almost all operating systems have a user...

Operating System Services Operating systems provide an environment for execution of programs and services to programs and users One set of operating-system services provides functions that are helpful to the user: – User interface - Almost all operating systems have a user interface (UI). Varies between Command- Line (CLI), Graphics User Interface (GUI), Batch – Program execution - The system must be able to load a program into memory and to run that program, end execution, either normally or abnormally (indicating error) – I/O operations - A running program may require I/O, which may involve a file or an I/O device. The operating system must provide a means to do I/O. Operating System Services (Cont.) – File-system manipulation - The file system is of particular interest. Programs need to read and write files and directories, create and delete them, search them, list file Information, permission management. Many operating systems provide a variety of file systems, sometimes to allow personal choice and sometimes to provide specific features or performance characteristics. – Communications – Processes may exchange information, on the same computer or between computers over a network Communications may be via shared memory or through message passing (packets moved by the OS) – Error detection – OS needs to be constantly aware of possible errors May occur in the CPU and memory hardware, in I/O devices, in user program For each type of error, OS should take the appropriate action to ensure correct and consistent computing Debugging facilities can greatly enhance the user’s and programmer’s abilities to efficiently use the system Operating System Services (Cont.) Another set of OS functions exists for ensuring the efficient operation of the system itself via resource sharing – Resource allocation - When multiple users or multiple jobs running concurrently, resources must be allocated to each of them Many types of resources - Some (such as CPU cycles, main memory, and file storage) may have special allocation code, others (such as I/O devices) may have general request and release code – Accounting - To keep track of which users use how much and what kinds of computer resources – Protection and security - The owners of information stored in a multiuser or networked computer system may want to control use of that information, concurrent processes should not interfere with each other Protection involves ensuring that all access to system resources is controlled Security of the system from outsiders requires user authentication, extends to defending external I/O devices from invalid access attempts If a system is to be protected and secure, precautions must be instituted throughout it. A chain is only as strong as its weakest link. A View of Operating System Services User Operating System Interface - CLI CLI or command interpreter allows direct command entry Sometimes implemented in kernel, sometimes by systems program Some operating systems treat the command interpreter as a special program that is running when a job is initiated or when a user first logs on – shells. For example, on UNIX and Linux systems, a user may choose among several different shells, including the Bourne shell, C shell, Bourne-Again shell, Korn shell, and others Primarily fetches a command from user and executes it – Sometimes commands built-in, sometimes just names of programs » If the latter, adding new features doesn’t require shell modification User Operating System Interface - GUI User-friendly desktop metaphor interface – Usually mouse, keyboard, and monitor – Icons represent files, programs, actions, etc – Various mouse buttons over objects in the interface cause various actions (provide information, options, execute function, open directory (known as a folder) – Invented at Xerox PARC Many systems now include both CLI and GUI interfaces – Microsoft Windows is GUI with CLI “command” shell – Apple Mac OS X is “Aqua” GUI interface with UNIX kernel underneath and shells available – Unix and Linux have CLI with optional GUI interfaces (CDE, KDE, GNOME) Touchscreen Interfaces Touchscreen devices require new interfaces – Mouse not possible or not desired – Actions and selection based on gestures – Virtual keyboard for text entry Choice of interface The choice of whether to use a command-line or GUI interface is mostly one of personal preference. – System administrators who manage computers and power users who have deep knowledge of a system frequently use the command- line interface. For them, it is more efficient, giving them faster access to the activities they need to perform. – On some systems, only a subset of system functions is available via the GUI, leaving the less common tasks to those who are command- line knowledgeable. – Commandline interfaces usually make repetitive tasks easier, in part because they have their own programmability. For example, if a frequent task requires a set of command-line steps, those steps can be recorded into a file, and that file canbe run just like a program. The program is not compiled into executable code but rather is interpreted by the command-line interface. These shell scripts are very common on systems that are command-line oriented, such as UNIX andLinux. System Calls System calls provide an interface to the services made available by an operating system. Typically written in a high-level language (C or C++), although certain low-level tasks (for example, tasks where hardware must be accessed directly) may have to be written using assembly-language instructions. Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use Typically, application developers design programs according to an application programming interface (API). The API specifies a set of functions that are available to an application programmer, including the parameters that are passed to each function and the return values the programmer can expect. System Calls 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), and Java API for the Java virtual machine (JVM) Why would an application programmer prefer programming according to an API rather than invoking actual system calls –One benefit concerns program portability. An application programmer designing a program using an API can expect her program to compile and run on any system that supports the same API –Actual system calls can often be more detailed and difficult to work with than the API available to an application programmer –For most programming languages, the run-time support system (a set of functions built into libraries included with a compiler) provides a system call interface that serves as the link to system calls made available by the operating system. The system-call interface intercepts function calls in the API and invokes the necessary system calls within the operating system. API – System Call – OS Relationship Types of System Calls System calls can be grouped roughly into six major categories: – Process control end, abort process load, execute process create process, terminate process get process attributes, set process attributes wait for time wait event, signal event allocate and free memory Types of System Calls – File management create file, delete file open, close file read, write, reposition get and set file attributes – Device management request device, release device read, write, reposition get device attributes, set device attributes logically attach or detach devices Types of System Calls (Cont.) – Information maintenance get time or date, set time or date get system data, set system data get and set process, file, or device attributes – Communications create, delete communication connection send, receive messages – Message-passing model, the communicating processes exchange messages with one another to transfer information. Messages can be exchanged between the processes either directly or indirectly through a common mailbox – Shared-memory model, process uses system calls to create and gain access to memory regions. Normally, the operating system tries to prevent one process from accessing another process’s memory. Shared memory requires that two or more processes agree to remove this restriction. They can then exchange information by reading and writing data in the shared areas. Types of System Calls (Cont.) – Protection Protection provides a mechanism for controlling access to the resources provided by a computer system. Typically, system calls manipulate the permission settings of resources such as files and disks, which specify whether particular users can—or cannot—be allowed access to certain resources. System Programs System programs, also known as system utilities, some of them are simply user interfaces to system calls. Most users’ view of the operation system is defined by system programs, not the actual system calls It provides a convenient environment for program development and execution. They can be divided into these categories: – File manipulation – Status information – Programming language support – Program loading and execution – Communications – Background services – Application programs System Programs File management - Create, delete, copy, rename, print, dump, list, and generally manipulate files and directories Status information – Some ask the system for info - date, time, amount of available memory, disk space, number of users – Others provide detailed performance, logging, and debugging information – Typically, these programs format and print the output to the terminal or other output devices – Some systems implement a registry - used to store and retrieve configuration information System Programs (Cont.) File modification – Text editors to create and modify files – Special commands to search contents of files or perform transformations of the text Programming-language support - Compilers, assemblers, debuggers and interpreters sometimes provided Program loading and execution- Once a program is assembled or compiled, it must be loaded into memory to be executed. Communications - Provide the mechanism for creating virtual connections among processes, users, and computer systems – Allow users to send messages to one another’s screens, browse web pages, send electronic-mail messages, log in remotely, transfer files from one machine to another System Programs (Cont.) Background Services – Launch at boot time Some for system startup, then terminate Some from system boot to shutdown – Provide facilities like disk checking, process scheduling, error logging, printing – Run in user context not kernel context – Known as services, subsystems, daemons Application programs – Don’t pertain to system – Run by users – Not typically considered part of OS – Launched by command line, mouse click, finger poke

Use Quizgecko on...
Browser
Browser