Presentation is loading. Please wait.

Presentation is loading. Please wait.

DOS- Disk Operating System. Contents Internals of DOS, DOS loading, DOS memory map, Concepts of TSR,

Similar presentations


Presentation on theme: "DOS- Disk Operating System. Contents Internals of DOS, DOS loading, DOS memory map, Concepts of TSR,"— Presentation transcript:

1 DOS- Disk Operating System

2 Contents Internals of DOS, DOS loading, DOS memory map, Concepts of TSR,

3 ROM-BIOS POST System configuration analysis Time of the day Print Screen Bootstrap loader I/O support programs

4 DOS Interface between user and computer Convert command into Computer actions DOS manager, BIOS caretaker

5 The structure of DOS Three layers are: ◦ The BIOS (Basic Input/Output System) ◦ The DOS kernel ◦ The command processor (shell)

6 The BIOS Module Specific to the individual computer system and is provided by the manufacturer of the system. It contains the default resident hardware-dependent drivers for the following devices: ◦ Console display and keyboard (CON) ◦ Line printer (PRN) ◦ Auxiliary device (AUX) ◦ Date and time (CLOCK$) ◦ Boot disk device (block device) MS-DOS kernel sends I/O request packets to these device drivers; the drivers translate these requests into the proper commands for the various hardware controllers.

7 The BIOS Module continued… In many MS-DOS systems, the most primitive parts of the hardware drivers are located in read-only memory (ROM) so that they can be used by stand-alone applications, diagnostics, and the system startup program. The terms resident and installable are used to distinguish between the drivers built into the BIOS and the drivers installed during system initialisation by DEVICE commands in the CONFIG.SYS file. The BIOS is read into random-access memory (RAM) during system initialisation as part of a file named IO.SYS.

8 MS-DOS Kernel The kernel provides a collection of hardware-independent services called system functions. - File Management - Memory Management - Device Input and Output - Process control

9 The DOS Kernel The kernel is a proprietary program and provides a collection of hardware-independent services called system functions. These functions include the following: ◦ File and record management ◦ Memory management ◦ Character-device input/output ◦ Spawning of other programs ◦ Access to the real-time clock

10 The DOS Kernel continued… Programs can access system functions by loading registers with function-specific parameters and then transferring to the operating system by means of a software interrupt. The DOS kernel is read into memory during system initialization from the MSDOS.SYS file on the boot disk. (The file is called IBMDOS.COM in PC-DOS.) This file is marked with the attributes hidden and system.

11 The Command Processor The command processor, or shell, is the user's interface to the operating system. It is responsible for parsing (describing) and carrying out user commands, including the loading and execution of other programs from a disk or other mass-storage device. The default shell that is provided with MS-DOS is found in a file called COMMAND.COM. It is a special class of program running under the control of MS-DOS.

12 More about COMMAND.COM Default MS-DOS shell, COMMAND.COM, is divided into three parts: ◦ A resident portion ◦ An initialization section ◦ A transient module The resident portion is loaded in lower memory, above the DOS kernel and its buffers and tables. It contains the routines to process Ctrl-C and Ctrl-Break, critical errors, and the termination (final exit) of other transient programs. This part of COMMAND.COM issues error messages and is responsible for the familiar prompt Abort, Retry, Ignore? The resident portion also contains the code required to reload the transient portion of COMMAND.COM when necessary.

13 More about COMMAND.COM continued… The initialization section of COMMAND.COM is loaded above the resident portion when the system is started. It processes the AUTOEXEC.BAT batch file (the user's list of commands to execute at system startup), if one is present, and is then discarded.

14 More about COMMAND.COM continued… The transient portion of COMMAND.COM is loaded at the high end of memory, and its memory can also be used for other purposes by application programs. The transient module issues the user prompt, reads the commands from the keyboard or batch file, and causes them to be executed. When an application program terminates, the resident portion of COMMAND.COM does a checksum of the transient module to determine whether it has been destroyed and fetches a fresh copy from the disk if necessary.

15 User Commands The user commands that are accepted by COMMAND.COM fall into three categories: Internal commands (carried out by code embedded in COMMAND.COM) External commands (names of programs stored on disk file) Batch files (batch or group of DOS commands)

16 DOS Loading When system starts/reset program execution begins at an address FFFF0H, which lies within ROM area, containing a jump instruction to system test code and the ROM bootstrap routine, ROM bootstrap routine reads the disk bootstrap routine from the boot sector of the system startup disk into memory at some arbitrary address, And then transfers control to it.

17 DOS Loading Continued…. The disk bootstrap routine checks for MS- DOS, by checking first two files from first sector of root directory. If not found user is prompted to change disk, and strike any key to try again. If found, both files will be read into memory by disk bootstrap routine and transfers controls to the initial entry point of IO.SYS.

18

19

20 DOS Loading Continued…. IO.SYS consists of two separate modules ◦ BIOS: containing the linked set of resident device drivers, ◦ SYSINIT: Supplied by Microsoft and linked into the IO.SYS file, along with the BIOS by the computer manufacturer. SYSINIT is called by BIOS initialisation code, Determines the contiguous memory present in the system and then relocates itself to high memory, Then it moves the DOS kernel, MS-DOS.SYS, from its original load location to its final location, overlaying the original SYSINIT code and any other expendable initialisation code of IO.SYS

21 DOS Loading Continued…. SYSINIT, next calls the initialisation code in MSDOS.SYS, DOS kernel initailises its internal tables and work areas, sets up the interrupt vectors 20H through 2FH, and traces through the linked list of resident device drivers, calling the initialisation function for each. These driver functions determine the equipment status, preform any necessary hardware initialisation, and set up the vectors for any external hardware interrupts the driver will service.

22

23

24 Boot Process Step 0: CPU Reset ◦ Blank memory, except ROM ◦ Start running from address FFFF0 (only 16 bytes left!) Step 1: Power-on self test (POST) Step 2: ROM BIOS startup program searches for and loads an OS Step 3: OS configures the system and completes its own loading Step 4: User executes applications software

25 Step 1: POST & BIOS Boot A built-in diagnostic program that checks the hardware to ensure that everything is present and functioning properly, before the BIOS begins the actual boot. It then continues with additional tests, e.g., memory test, as boot process is proceeding. The ROM BIOS startup program surveys hardware resources and needs, and assigns system resources to meet those needs

26 POST

27 Step 2: BIOS Finds & Loads OS Most often the OS is loaded from logical drive C on the hard drive Configuration information on CMOS chip tells startup BIOS where to look for the OS BIOS turns to that device, reads the beginning files of the OS, copies them into memory, then turns control over to the OS ◦ Master Boot Record (MBR) loaded.

28 BIOS Finds & Loads OS 28

29 Step 3: OS Completes Boot The OS checks some of the same things that startup BIOS checked (e.g., available memory and whether memory is reliable) The OS loads software to control the mouse, a CD-ROM, a scanner, and other peripheral devices (generally have device drivers) 29

30 Boot Process 30

31 Step 4: User Executes Applications Software The OS finds the applications software (on a secondary storage device), copies software into memory, and turns control over to it User commands the applications software, which makes requests to the OS, which uses the system resources, system BIOS, and device drivers to interface with and control the hardware 31

32 8086 MEMORY MAP   64 K ROM BIOSF0000H - FFFFFH   384 K ROMROM BASIC Present in older computers   Reserved ROM   Video BIOS ROMC0000H - C7FFFH   A0000H Video RAMA0000H - BFFFFH    User RAM 640 K RAM   Resident portion of DOSVaries between 12 K to 40 K   BIOS and DOS data area00400H - 005FFH  1 K Interrupt Vector Table00000H - 003FFH 8086 MEMORY MAP

33 Comparison between DOS and BIOS ParametersDOSBIOS Related toDisk OperationsCovers all I/O devices Loadedfrom Bootable disk(hard/ floppy disk) In ROM Uses function of BIOSNot uses DOS functions HardwareIndependentDependent Command Set OwnNot Command Interpreter Yes: Copy, print and delete files No: Ex:MOV AH,01H INT 21H MOV AH,00H MOV AL,03H INT 10H

34 File Management Block Devices are accessed on a sector basis. The MS- DOS kernel through the device driver sees a block as a logical fixed size array of sectors. the device driver in turn translates the logical sector requests from the MS – DOS into physical locations on the block device. MS – DOS file system is divided into four parts - Boot Sector - Always at the beginning of a partition. - Contains OEM identification, a loader routine, and a BIOS parameter block. - File Allocation Tables (FAT) - Provides a map to the storage locations of files on the disk by indicating which clusters are allocated to each file. - Second copy of FAT as back up. - Free cluster is found by scanning the FAT for a zero value. - Root directory - Root directory entries are 32 bytes long. - Each entry includes a filename and extension, size, starting FAT entry, the time and date the file was created and the files attributes. - Files Area - Contains subdirectories, file data and unallocated clusters. - The area is divided into fixed size clusters and the use for a particular cluster is specified by the corresponding FAT entry

35 Memory Management Based on a pool of variable sized memory blocks. Two basic functions are to allocate a block from the pool and to return the allocated block to the pool. MS-DOS compatible personal computers can be fitted with three kinds of RAMs ◦ Conventional Memory ◦ Expanded Memory ◦ Extended Memory Conventional Memory - Up to 1MB of Memory is directly addressable. - Physical addresses for references are generated by a 16-bit segment register combined with 16-bit offset. - Out of 1MB MS-DOS occupies 640KB of the conventional memory. - This 640KB is divided into three zones - The interrupt vector table - Occupies lowest 1024 bytes of memory. - Its address and length are hardwired into the processor and cannot be changed. - The operating system area - Begins immediately above the interrupt vector table. - Holds the operating system, its tables and buffers, and device drivers. - Amount of memory occupied varies from version to version of MS-DOS. - The transient program area - Remainder of the 640KB area. - Organized into a structure called Memory Arena, which is divided into arena entries (memory blocks). - Each arena entry has a arena entry header.

36 How MS-DOS supports Conventional Memory Management The MS-DOS kernel supports three memory management functions, invoked with interrupt 21H, which operate on the TPA: - Function 48H (Allocate Memory block) - Function 49H (Free Memory block) - Function 4AH (Resize Memory block) The memory manager can use any of three allocation strategies: - First fit – the arena entry at the lowest address that is large enough to satisfy the request. - Best fit – the smallest available arena entry that satisfies the request, regardless of its position. - Last fit – the arena entry at the highest address that is large enough to satisfy the request Default approach used by MS-DOS is First-fit approach. Expanded Memory - To circumvent the 1MB limit of conventional memory, expanded memory was designed. - As much as 8MB of expanded memory can be installed in a single machine. - Made available to the application software in 16KB pages. Expanded Memory Manager - Provides an interface between application programs and expanded memory. - Divided into Driver and Manager. - Manager controls the status, allocation, mapping and deallocation of expanded memory. Extended Memory - Storage at addresses above 1MB that can be accessed in Protected mode. - Extended memory is linearly addressable, so no manager required.

37 Device Input and Output MS-DOS recognizes two types of devices: block devices e.g. floppy disk or fixed disk drives; and character devices, e.g keyboard, display, printer, and communication ports. MS-DOS identifies each block device by a drive letter assigned when the devices controlling software, the device driver, is loaded. A character device on the other hand, is identified by a logical name built into the device driver. Distinction between character and block devices is that the MS-DOS always adds new block – device drivers to the tail of the driver chain but adds new character – device drivers to the head of the chain. Techniques to access character devices: - Handle type function calls A handle is a 16 bit number returned by the operating system whenever a device is opened or created. - Character input and output functions: Interrupt 21H functions 01H to 0CH. These functions are designed to communicate directly with the keyboard, display, printer and serial port. Process Control Process, or task, control includes program loading, task execution, task termination, task scheduling and intertask communication. MS-DOS is not a multitasking operating system,it is a single tasking operating system.

38 Computer Memory and Memory Mapping Use of Hardware mapping registers in protected address space Programs are at same address space and executed simultaneously It maps pages of two sizes(4 KB and 2 MB) Processes of 1 user are protected from other users process Users are not able to use other users data

39 Hardware Memory Mapping Register CR3 is the hardware mapping register It points to table available in computer memory CR3 contains the address of top level table(Page map level4) Page Map Level: It has 512 entries which points different pages in memory first level of memory translation hierarchy logical to virtual address 0-11 bit page offset 12-20 page table index 21-29 page directory index 30-38 page directory pointer 39-47 PML index

40 Hardware Memory Mapping Register Page Directory Pointer Table second level of memory translation 512 entries, points to Page Directory Table Page Directory Table third level of memory translation 512 entries, points to Page Table Page Table fourth level of memory translation 512 entries, points to Pages in memory physical address of destination TLB available in cache Recently used pages

41 BIOS and DOS Interrupts BIOS Calls: INT 10H FunctionDescriptionInputOutput 00H Set Video ModeAH=00h AL= Video Mode Nothing 01H Set Cursor TypeAH=01h CH= Starting Line of Cursor CL= Ending Line of Cursor Nothing 02H Set Cursor Position AH=02h BH= Page DH= row (x co-ordinate) DL= column (y co-ordinate) Nothing 03H Get Cursor Position AH=03h BH= Page CH= Starting of Cursor CL= Ending of Cursor DH= row DH= column 08HRead character and attribute at cursor AH=08h BH= Page AH=attribute AL= character

42 BIOS and DOS Interrupts BIOS Calls: INT 10H Functio n DescriptionInputOutput 09HWrite character and attribute at cursor AH=09h AL= character BH=Page BL= Attribute or color CX= count of characters Nothing 0AHWrite character at cursor AH=0Ah AL= character BH=Page BL= color (graphics) CX= count of characters Nothing 0CHWrite graphics pixel AH=0Ch AL= Pixel value BH=Page CX= Column (X) DX=Row(Y) Nothing

43 BIOS and DOS Interrupts DOS Calls: INT 21H FunctionDescriptionInputOutput 00H Terminate Process AH=00h CS= Seg address of PSP Nothing 01H Character input with echo AH=01hAL= 8 bit input data 02H Character outputAH=02h DL= 8 bit data to output Nothing 08H Character input without echo AH=08hAL= 8 bit input data 09HDisplay StringAH=09h DS:DX= Segment: offset of string Nothing

44 BIOS and DOS Interrupts DOS Calls: INT 21H File Operations FunctionDescriptionInputOutput 3CH Create FileAH=3Ch CX= File attribute DS:DX= offset of path name Successful: CF=0, AX= Handle unsuccessful: CF=1, AX= Error code 3DH Open FileAH=3Dh AL= Access Mode DS:DX= offset of path name Successful: CF=0, AX= Handle unsuccessful: CF=1, AX= Error code 3EH Close FileAH=3Eh BX= Handle Successful: CF=0 unsuccessful: CF=1 AX= Error code 3FH Read FileAH=3Fh BX= Handle CX= no of bytes to read DS:DX =offset of path name Successful: CF=0, AX= bytes transferred unsuccessful: CF=1, AX= Error code 40H Write FileAH=40h BX= Handle CX= no of bytes to write DS:DX =offset of buffer Successful: CF=0, AX= bytes transferred unsuccessful: CF=1, AX= Error code


Download ppt "DOS- Disk Operating System. Contents Internals of DOS, DOS loading, DOS memory map, Concepts of TSR,"

Similar presentations


Ads by Google