OPERATING SYSTEM - PowerPoint PPT Presentation

OPERATING SYSTEM. LESSON 3. OPERATING SYSTEM CONCEPTS. All operating systems have certain basic concepts such as processes, memory, and files. A general OS do following jobs in a computer system :. Process Management Scheduling Inter - process Communication Memory Management.

Copyright Complaint Adult Content Flag as Inappropriate

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

Download Presentation

PowerPoint Slideshow about ' OPERATING SYSTEM' - ordell

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

Before a file is read or written, it must be opened by checking the permissions. If the access is permitted, the system returns a small integer called a file descriptor to use in subsequent operations. If the access is prohibited, an error code is returned.

Computers contain large amounts of information that users often want to keep confidential. This information may include electronic mail, business plans, tax returns, and much more.

As a simple example, just to get an idea of how security can work, consider UNIX. Files in UNIX are protected by assigning each one a 9-bit binary protection code. The protection code consists of three 3-bit fields, one for the owner, one for other members of the owner’s group (users are divided into groups by the system administrator), and one for everyone else. Each field has a bit for read access, a bit for write access, and a bit for execute access. These 3 bits are known as the rwx bits.

For example, the protection code rwxr-x--xmeans that the owner can read, write, or execute the file, other group members can read or execute (but not write) the file, and everyone else can execute (but not read or write) the file. For a directory, x indicates search permission. A dash means that the corresponding permission is absent.

OS provides the set of system calls that is an interface between the operating system and the user programs.

The system calls vary from operating system to operating system.

System calls are highly machine dependent and often must be expressed in assembly code. So an OS provides a procedure library to make system calls from C programs and often from other languages as well.

The operating system then figures out what the calling process wants by inspecting the parameters. Then it implements the system call and returns control to the instruction following the system call.

In a sense, making a system call is like making a special kind of procedure call, only system calls enter the kernel and procedure calls do not.

Let us take a quick look at the service, such as reading data from a file, it has to execute a trap or system call instruction to transfer control to the operating system. read system call. It has three parameters: the first one specifying the file, the second one pointing to the buffer, and the third one giving the number of bytes to read. Like nearly all system calls, it is invoked from C programs by calling a library procedure with the same name as the system call: read. A call from a C program might look like this:

count = read(fd, buffer, nbytes);

The system call returns the number of bytes actually read in count.

If the system call cannot be carried out, either due to an invalid parameter or a disk error, count is set to -1, and the error number is put in a global variable, errno. Programs should always check the results of a system call to see if an error occurred.

Windows and UNIX differ in a fundamental way in their respective programming models.

A UNIX program consists of code making system calls to have certain services performed.

In contrast, a Windows program is normally event driven. The main program waits for some event to happen, then calls a procedure to handle it. Typical events are keys being struck, the mouse being moved, a mouse button being pushed, or a floppy disk inserted. Handlers are then called to process the event, update the screen and update the internal program state.

In UNIX, there is almost a 1-to-1 relationship between the system calls and the library procedures used to invoke that system calls. In other words, for each system call, there is roughly one library procedure that is called to invoke it, as indicated in above slides. Furthermore, POSIX has only about 100 procedure calls.

Of course, Windows also has system calls. But in Windows, the situation is radically different. The library calls and the actual system calls are highly decoupled (seperated).

Microsoft has defined a set of procedures, called the Win32 API (Application Program Interface) that programmers are expected to use to get operating system services.

A trend in modern operating systems is to move code up into higher layers and remove as much as possible from kernel mode, leaving a minimal microkernel.

The usual approach is to implement most of the operating system in user processes.

A called the ll thejobthatkernel doesis handle the communication between clients and servers.

By splitting the operating system up into parts, each of them only handles one partof the system, such as file service, process service, terminal service, or memory service, each part becomes small and manageable.

Because all the servers run as user-mode processes, and not in kernel mode, they do not have direct access to the hardware. As a consequence, if a bug in the file server is triggered, the file service may crash, but this will not effectwholemachine.