8-Abstraction, Design Issues and Structures of OS-27!04!2023
8-Abstraction, Design Issues and Structures of OS-27!04!2023
• This abstraction can be used to hide certain hardware details from users and applications. Thus,
changes in the hardware are not seen by the user (even though the OS must accommodate
them).
• This is particularly advantageous for venders that want offer a consistent OS interface across an
entire line of hardware platforms.
• For example, certain operations such as interaction with 3D graphics hardware can be controlled
by the operating system. When an instruction pertaining to the hardware is executed and if the
hardware is present then all is fine. However, if the hardware is not present then a trap is
generated by the illegal instruction. In this case the OS can emulate the desired instruction in
software.
• Another way that abstraction can be used is to make related devices appear the same from the
user point of view. For example, hard disks, floppy disks, CD-ROMs, and even tape are all very
different media, but in many operating systems they appear the same to the user.
• Unix, and increasingly Windows NT, take this abstraction even further. From a user and
application programmer standpoint, Unix is Unix regardless of the CPU make and model.
What is an API?
• API, an abbreviation of application program interface, is a set of routines,
protocols, and tools for building software applications. A good API makes it
easier to develop a program by providing all the building blocks. A
programmer then puts the blocks together.
You can provide your application with a graphical user interface; access
system resources such as memory and devices; display graphics and
formatted text; incorporate audio, video, networking, or security.
• Where Applicable
The Windows API can be used in all Windows-based applications. The
same functions are generally supported on 32-bit and 64-bit Windows.
• Developer Audience
This API is designed for use by C/C++ programmers. Familiarity with the
Windows graphical user interface and message-driven architecture is
required.
Application Programming Interface (API)
Kernel
It is library named KERNEL32.DLL, which supports capabilities associated
with OS such as
Process Loading.
Context switching.
File I/O.
Memory Management.
User
It is library named USER32.DLL, which allows managing the user interface
such as
Windows.
Menus.
Dialog Boxes.
Icon.
GDI
It is library named GDI32.DLL, using GDI windows draws windows, menus and
dialog boxes
It can create graphical output.
Also use for storing Graphical Images.
EXAMPLE WIN32 API
• Application window is created by calling the API function CreateWindow().
hwnd = CreateWindow
(“classname”, // window class name
TEXT ("The First Program"), // window caption
WS_OVERLAPPEDWINDOW, // window style
CW_USEDEFAULT, // initial x position
CW_USEDEFAULT, // initial y position
CW_USEDEFAULT, // initial x size
CW_USEDEFAULT, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInstance, // program instance handle
NULL) ; // creation parameters, may be used to point some data for reference.
• Overlapped window will be created, it includes a title bar, system menu to the left of
title bar, a thick window sizing border, minimize, maximize and close button to the
right of the title bar.
• The window will be placed in default x, y position with default size. It is a top level
window without any menu.
• The CreateWindow() will returns a handle which is stored in hwnd.
Why is API Design Important?
• APIs can be among a company's greatest assets
– Customers invest heavily: buying, writing, learning
– Cost to stop using an API can be prohibitive
– Successful public APIs capture customers
Process Management
Main Memory Management
File Management
I/O System Management
Secondary Management
Networking
Protection System
Command-Interpreter System
OPERATING SYSTEM SYSTEM
COMPONENTS
STRUCTURES
PROCESS MANAGEMENT
A process has resources (CPU time, files) and attributes that must be managed.
FILE MANAGEMENT
A file is a collection of related information defined by its creator. Commonly, files
represent programs (both source and object forms) and data.
The operating system is responsible for the following activities in connections with file
management:
– File creation and deletion.
– Directory creation and deletion.
– Support of primitives for manipulating files and directories.
– Mapping files onto secondary storage.
– File backup on stable (nonvolatile) storage media.
OPERATING SYSTEM System
STRUCTURES Components
I/O MANAGEMENT
Buffer caching system
Generic device driver code
Drivers for each device - translate read/write requests into disk position
commands.
Disk scheduling
OPERATING SYSTEM System
STRUCTURES Components
NETWORKING
Communication system between distributed processors.
Getting information about files/processes/etc. on a remote machine.
Can use either a message passing or a shared memory model.
SYSTEM PROGRAMS
Command Interpreters -- Program that accepts control statements
(shell, GUI interface, etc.)
Compilers/linkers
Communications (ftp, telnet, etc.)
OPERATING SYSTEM System
STRUCTURES Tailoring
Modifying the Operating System program for a particular machine. The goal is to include
all the necessary pieces, but not too many extra ones.
Typically a System can support many possible devices, but any one installation has
only a few of these possibilities.
Plug and play allows for detection of devices and automatic inclusion of the code
(drivers) necessary to drive these devices.