File Systems-System Programming-Lecture Notes, Study notes of System Programming

This lecture handout is for System Programming course. It was provided by Prof. Indubhushan Vijayabhas at Ambedkar University, Delhi. It includes: File, System, Include, Void, Main, Unsigned, Program, Address, Register, String, Source, Channel

Typology: Study notes

2011/2012

Uploaded on 08/07/2012

anishay
anishay 🇮🇳

4.2

(25)

118 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture # 25
This program attempts to perform memory to memory transfer operation. This program
will only work for a 8086 processor, higher processors’ DMA may not support memor to
memory transfer.
#include <dos.h>
#include <bios.h>
char st[2048]="hello u whats up?\0";
char st1[2048]="xyz";
unsigned long inttemp;
unsigned int i;
void main (void)
{temp=_DS;
temp = temp<<4;
i = *((unsigned int *)(&temp));
temp = temp >>16;
outportb(0x87,*((unsigned char *)(&temp)));
outportb(0,*((unsigned char *)(&i)));
outportb(0,*(((unsigned char *)(&i))+1));
outportb(1,0xff);
outportb(1,0x07);
outportb(0x0b,0x88);
temp=_DS;
temp= temp+128;
temp=temp<<4;
i= *((unsigned int *)(&temp));
temp=temp>>16;
outportb(0x83,*((unsigned char *)(&temp)));
outportb(2,*((unsigned char *)(&i)));
outportb(2,*(((unsigned char *)(&i))+1));
docsity.com
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download File Systems-System Programming-Lecture Notes and more Study notes System Programming in PDF only on Docsity!

Lecture # 25

This program attempts to perform memory to memory transfer operation. This program

will only work for a 8086 processor, higher processors’ DMA may not support memor to

memory transfer.

#include <dos.h> #include <bios.h>

char st[2048]="hello u whats up?\0"; char st1[2048]="xyz"; unsigned long int temp; unsigned int i;

void main (void) { temp=_DS; temp = temp<<4; i = *((unsigned int *)(&temp)); temp = temp >>16;

outportb(0x87,*((unsigned char )(&temp))); outportb(0,((unsigned char )(&i))); outportb(0,(((unsigned char *)(&i))+1)); outportb(1,0xff); outportb(1,0x07); outportb(0x0b,0x88); temp=_DS; temp= temp+128; temp=temp<<4; i= *((unsigned int )(&temp)); temp=temp>>16; outportb(0x83,((unsigned char )(&temp))); outportb(2,((unsigned char )(&i))); outportb(2,(((unsigned char *)(&i))+1));

This program, programs the channel 0 and channel 1 of the DMA. It loads the address of

Source string st in base register and the Latch B and loads the count register for channel 0

and does the same for st1. It then programs the mode, mask and command register for

memory to memory transfer and to unmask channel 0 and channel 1.

outportb(3,0xff); outportb(3,0x07); outportb(0x0b,0x85); outportb(0x08,1); outportb(0x0f,0x0c); outportb(0x09,0x04); while (!kbhit()) { printf("Channel 0 = %x,% x\n",inportb(0x01),inportb(0x01)); printf("Channel 1 = %x,% x\n",inportb(0x03),inportb(0x03)); printf("Status = % x\n",inportb(0x08)); } puts(st1); }

File Systems

File System

  • Disk Architecture
  • Disk Partitioning
  • File systems

Addressable unit Parameters

  • Heads
  • Sectors
  • Tracks

An addressable unit on disk can be addressed by three parameters i.e. head #, sector # and

track #. The disk rotates and changing sectors and a head can move to and fro changing

tracks. Each addressable unit has a unique combination of sec#, head# and track# as its

physical address.

Blocks

  • Blocks are the sectors per track
  • Smallest addressable unit in memory
  • Address of block is specified as a unique combination of three parameters (i.e. track, head, sec)

Density of Magnetic media

  • Density of magnetic media is the determinant of the amount of data that can reside stably on the disk for example floppy disk come with different densities.
    • Double Density
    • High Density

Effect of surface area on disk size

  • Increasing the surface area clearly increases the amount of data that can reside on the disk as more magnetic media no resides on disk but it might have some drawbacks like increased seek time in case only one disk platter is being used

Cylinders

  • In case of hard disk where there are number of platters the term track is replaced by cylinder
  • Cylinder is a collection of corresponding tracks if track on platter changes so will the tracks on rest of the platters as all the heads move simultaneously

Rotational Delay

  • While accessing a selected block the time required by the disk to rotate to the specified sector is called rotational delay

Seek Time

  • While accessing a selected block Time required by the head to reach the particular track/cylinder is called seek time

Access Time

  • The accumulative time that is required to access the selected block is called access time
  • Access time includes the delay required by disk rotation as well as head movement.