0% found this document useful (0 votes)
92 views

CS609 - Final Term Solved Subjective With References by Moaaz

Uploaded by

Dani
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views

CS609 - Final Term Solved Subjective With References by Moaaz

Uploaded by

Dani
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 17

CS609 - System Programming

Solved Subjective July 10,2013


From Final term Papers

MC100401285 [email protected] PSMD01


[email protected]

CS609 - Final Term Papers Fall 2012


Q#1 In how many ways higher PC can operate?
Answer:- (Page 319)
Higher PCs can operate in two modes
• REAL MODE
• PROTECTED MODE

Q#2 In FAT32, what is the size of FSInfo?


Answer:-
On a FAT32 volume, the FAT can be a large data structure, unlike on FAT16 where it is limited to a maximum of
128K worth of sectors and FAT12 where it is limited to a maximum of 6K worth of sectors.

Q#3 A disk is divided into three partition. What type of information is represented in code part of
partition table?
Answer:- (Page 219)
code part contains valid executable code

Q#4 Differences between FAT16 and FAT32


Answer:-

1
Q#5 How ISR sends EOI (End of interrupt) signals to master and slave .Required statement must be in C
program
Answer:-
void irq_handler(registers_t regs)
{
// Send an EOI (end of interrupt) signal to the PICs.
// If this interrupt involved the slave.
if (regs.int_no >= 40)
{
// Send reset signal to slave.
outb(0xA0, 0x20);
}
// Send reset signal to master. (As well as slave, if necessary).
outb(0x20, 0x20);

if (interrupt_handlers[regs.int_no] != 0)
{
isr_t handler = interrupt_handlers[regs.int_no];
handler(&regs);
}

Q#6 Suppose a disk is divided into two partition and we have read MBR at LBA=0 to get information
about primary partition
a) How many bytes of code part we need to skip to get information about primary partition?
b) How many bytes of code part we need to read information?

Q#7 Distinguish between 80287 and 80387


Answer:- (Page 170)
If the sign of infinity can be reversed than the coprocessor is 80387 otherwise its 80387.

Q#8 Write down procedure to convert a cluster number into sector number
Answer:- (Page 308)
NTFS simply the following formula will be used to translate the sector number into cluster number.
Sector # = Cluster # * Sector Per Cluster

Q#9 How a PC operates in protected mode?


Answer:- (Page 326)
• PC has to be shifted to Protected Mode if originally boots in Real Mode.
• In Protected Mode whole of the RAM is accessible that includes the Conventional, Expanded and Extended
Memories.
• OS like Windows has a memory management system for Protected Mode.
• A privilege level can be assigned to a memory area restricting its access.

2
Q#10 Describe how a chain of cluster in FAT12 is managed?
Answer:- (Page 291)

CS609 - Final Term Papers Fall 2012


2 marks.
How larger file contents can be managed using FAT?
Answer:- (Page 264)
• Larger files would be comprised of numerous clusters.
• The first Cluster # can be read from FCB for rest of the Cluster, a chain is maintained within the FAT.

3
what is the control information in PSP (program segment prefix) contain?
Answer:- (Page 321)
It contains control information like DTA (Disk Transfer Area) and command line parameters.

What does it indicates if the value of first bytes of data part of partition table is 00H?

Suppose we want to program the interval timer, why we do prefer to use the channel 2 for this purpose and
why?

3 Marks
How many possible entries are there in FAT12 and FAT16?
Answer:- Click here for detail
FAT12 and FAT16 media typically use 512 root directory entries.

Write down the names of three data structure used for memory management?
Answer:- (Page 321)
• DOS makes use of various Data Structures for Memory Management:
• MCB ( Memory Control Block )
• EB ( Environment Block )
• PSP ( Program Segment Prefix )

5 Marks.
What are interrupt function pointers? Explain with examples.
Answer:- (Page 22)
Interrupt pointers and functions
Interrupt functions are special function that as compared to simple functions for reasons discussed earlier. It can be
declared using the keyword interrupt as shown in the following examples.
void interrupt newint ( )
{
...
...
}

Similarly a pointer to such interrupt type function can also be declared as following
void interrupt (*intptr) ( );

where intptr is the interrupt pointer and it can be assigned an address using the getvect() function
intptr = getvect(0x08);

Now interrupt number 8 can be invoked using the interrupt vector as following
(*intptr) ( );

4
What is fragmentation? And how we remove it using defragmentation.
Answer:- (Page 316)
• Fragmentation means that clusters of a same file are not contiguously placed, rather they are far apart,
increasing seek time hence access time.
• So its desirable that files clusters may be placed contiguously, this can be done by compaction or defragme
notation.
• Defragmentation Software reserves space for each file in contiguous block by moving the data in clusters and
Re-adjusting.
• As a result of defragmentation the FAT entries will change and data will move from one cluster to other
localized cluster to reduce seek time.
• Defragmentation has high computation cost and thus cannot be performe d frequently.

What is cluster? Describe it key characteristics.


Answer:- (Page 342)
• A cluster is a collection of contiguous blocks.
• User Data is divided into clusters
• Number of blocks within a cluster is in power of 2.
• Cluster size can vary depending upon the size of the disk.
• DOS has a built in limit of 128 blocks per cluster.
• But practically limit of 64 blocks per cluster has been established.

A cluster is not the same as block and also there are no system calls available which use the cluster number. All
the system calls use the LSN address. If the cluster number is known it should be converted into LSN to access
the blocks within the cluster. Moreover all the information about file management uses the cluster number
rather than the LSN for simplicity and for the purpose of managing large disk space. So here we devise a
formula to convert the cluster number into LSN.

After calculating the sector number for the cluster the contents of the file can be accessed by reading all the
blocks within the cluster. In this way only the starting cluster will be read. If the file contains a number of
cluster the subsequent clusters numbers within the file chain can be accessed from the FAT.

Int 0*0f can be used to perform program interrupt printer I/O. what are the requirements to enable it.
Answer:- (Page 96)
The interrupt should be enabled in the printer control register; secondly it should also be unmasked in the IMR in
PIC. The program can then intercept or set the vector of interrupt 0x0f by placing the address of its function
newint();
The newint() will now be called whenever the printer can perform output. This newint() function writes the next
byte in buffer to the data registers and then send a pulse on the strobe signal to tell the printer that data has been sent
to it. When whole of the buffer has been sent the int 0x0f vector is restored, interrupt is masked and the memory for
the program is de-allocated.

5
CS609 - Final Term Papers Fall 2012
4 question of 2 marks
Q1) when we talk about FAT32 what is the size of FSInfo block?
Answer:- Rep

Q2) what is the control information in PSP (program segment prefix) contain?
Answer:- Rep

Q3) what does it indicates if the value of first byte of data part of the partition table is 80h?

Q4) What is the difference between the getvect and sectvect function?
Answer:-
setvect() :- Get Interrupt Vector Entry
Setvect() stores the address of an interrupt handler (which must be declared to be of type void interrupt) in the
specified interrupt vector. For example, the code needed to store the address of kb_ih() (the keyboard interrupt
handler) in interrupt vector location KEY_INT (with the value 9) is:
setvect(KEY_INT, kb_ih);

getvect() :- Set Interrupt Vector Entry


The getvect() function returns a copy of the 32-bit interrupt address stored in a specific interrupt vector. For
example, the code to obtain a copy of the original clock handler's address stored in interrupt vector 8(defined
in i8259.h as CLK_INT) and to store it in the variable old_clock (declared to be of type void interrupt), would
be:
void interrupt (*old_clock)();
...
old_clock = getvect(CLK_INT);

4 question of 3 marks
Q1) suppose we read the contents of Drive parameter block and get the following information .
Number of reserved blocks=2
Number of blocks in FAT= 7
Number of blocks in root directory=32
Find the number of systems blocks .make the appropriate assumptions when needed.

Q2) what is MFT?

6
Answer:-
Each file on an NTFS volume is represented by a record in a special file called the master file table (MFT).
NTFS reserves the first 16 records of the table for special information.

Q3) Write the names of three different viruses?


Answer:- (Page 332)
• Partition Table Virus
• Boot Sector Virus
• File Viruses

Q4) Name the registers used by program interrupt controller(PCI)?


Answer:- (Page 50)
ISR, IMR and IRR

4 question of 5 marks
Q1) Write down the TSR program that intercepts the interrupt 17H and gives all the spaces in print
document.
Answer:- (Page 88)
#include <dos.h>
void interrupt (*old)( );
void interrupt newint ( );
main( )
{
old = getvect(0x17);
setvect(0x17,newint);
keep(0,1000);
}
void interrupt new ()
{ if (_AH==0)
{
if ((_AL=='A') || (_AL=='Z')) //corrected
return;
(*old)();
}
}

Q2) Write down a procedure to convert the cluster number into sector number?
Answer:- Rep

Q3) How disk scan identify the bad sectors?


Answer:- (Page 315)
• It attempts to write a block.
• After write it reads back the block contents.

7
• Performs the CRC test on data read back.
• If there is an error then the data on that block is not stable the cluster of that block should be marked bad.
• The cluster is marked bad by placing the appropriate code for bad cluster so that they may not be allocated to
any file.

Q4) Write down an algorithm that can be used to extract the entries from a FAT12 data structure?
Answer:- (Page 267)
offset = cluster No * 3/2
temp = cluster No * 3%2
if (temp == 0)
{
Then the entry is even, consider the word at this
offset. Make a 12-bit value, by selecting the low
Nibble of the high byte of this. Use this Nibble as
the higher 4-bits. And use the low byte as the lower
eight bits.
}
else
{
The entry is odd, consider the word at this offset.
Select the high Nibble of the low byte as lower 4-bits.
And select high byte as the higher 8-bits.
}

CS609 - Final Term Papers Spring 2012


1) LBA =0 & LSN = 0 is both are same or not explain ?
Answer:- (Page 240)
The LBA=0 block is the first block on disk. Whereas each logical partition has LSN=0 block which is the first
block in logical drive and is not necessarily the first block on physical drive.

2) Find the root directory sector where Reserved sector =1 Sector per FAT = 9 use appropriate assumption
when needed?

3) How many maximum directories entries are possible in FAT12 & FAT 16?
Answer:- Rep

4) Recovery of deleted contents of file write all steps?

8
Answer:- (Page 279)
• The contents can be recovered by placing a valid file name, character in place of E5 and then
recovering the chain of file in FAT.
• If somehow the clusters used by deleted file have been overwritten by some other file, it cannot be
recovered.

5) Write down state of viruses only name?


Answer:- (Page 331)
• Dormant State
• Activation State
• Infection State

6) Write down the condition of status of register A in real time mode?

7) Why FAT16 use FSInfo block?

8) On interrupt 13H/42H write down the states of DS:SI registers?


Answer:- (Page 216)
DS:SI= far address of Disk address packet

9) What is COM File?


Answer: - (Page 333)
• COM File is a mirror image of the program code. Its image on disk is as it is loaded into the memory.
• COM Files are single segment files in which both Code and Data resides.
• COM File will typically have a Three Bytes Near Jump Instruction as the first instruction in program which
will transfer the execution to the Code Part of the Program.

10) De fragmentation has high computation cost explain why & how?
Answer: - (Page 316)
• Defragmentation Software reserves space for each file in contiguous block by moving the data in clusters and
readjusting.
• As a result of defragmentation the FAT entries will change and data will move from one cluster to other
localized cluster to reduce seek time
• Defragmentation has high computation cost and thus cannot be performe d frequently.

CS609 - Final Term Papers Spring 2012


DTE want to communicate with DCE sing RC232c protocol,how does this communication start and
end ,identify steps
9
Answer: - (Page 109)
The pin outs of the DB25 connector used with RS232C.

Write down the structure of COM files?


Answer: - Rep

How many maximum root directory entries are pssible in FAT12 and FAT16?
Answer: - Rep

What is MFT?
Answer: - Rep

function that will convert BCD to ASCII code


Answer: - (Page 148)
printf()

What is the major disadvantage of programmed I/O ?


Answer: - (Page 08)
The main disadvantage of programmed I/O as can be noticed is that the CPU is busy waiting for an I/O
opportunity and as a result remain tied up for that I/O operation.

how many bytes are used in FCB in FAT 32

What is the disadvantage of undocumented services of interrupts?

What is virus ?
Answer: - (Page 331)
Viruses are special program having ability to embed themselves in a system resources and there on propagate
themselves.

what is cluster ? decribe its strusture ?


Answer: - Rep

how many state of viruses ?


Answer: - Rep

CS609 - Final Term Papers Spring 2012


Q-1: What are IBF and OBF?
Answer: -
IBF (input buffer full) bit. A device driver can check this bit to see if a character has been received from the

10
keyboard on which this bit will turn to 1.
OBF ( output buffer full bit of port 64H which remains set as long as the byte is not received by the keyboard.

Q-2: How to convert the Logical address directly into the Physical address?
Answer: - (Page 325)
In Protected Mode the direct method of seg * 10H + offset for Logical to Physical address translation is
discarded and an indirect method is adopted.

Q-3: How to find the Lost chains in Disk Scan?


Answer: - (Page 315)
• The disk scanning software may also look for lost chains.
• Lost chains are chains in FAT which apparently don’t belong to any file.
• They may occur due to some error in the system like power failure during deletion process.

CS609 - Final Term Papers Spring 2012


1. Write down the function of FSinfo in FAT 32. (2)
Answer: - (Page 299)
The block contains some information required by the operating system while cluster allocation/deallocation to files.

2.Write down direct method for logical to physical address translation. (2)
Answer: - Rep

3.How can we calculate the correct cylinder number between two partitions of a high capacity hard disk? (2)

4. Why we need buffering in UART FIFO queue? (2)


Answer: - (Page 118)
A queue or a buffer of the input or output bytes is maintained within the UART in order to facilitate more efficient
I/O. The size of the queue can be controlled through this register.

5. Write down the formula to translate cu\luster number into LSN for FAT 32. (3)
Answer: - (Page 259)
No. of System Area Blocks = Reserved Block + Sector per FAT * No. of FAT’s + No. of entries * 32 / Bytes per Block
First User Block No. = No. of System Area Blocks
=>Sector No. = (Clust_no – 2)* Blocks per Clust + First User Block #

6. What are selectors and why we use them? (3)


Answer: - (Page 259)
• In Protected Mode the Segment Registers are used as Selector.
11
• As the name suggest they are used to select a descriptor entry from some Descriptor Table.

7. How many maximum root directory entries are possible in FAT12 and FAT16? (3)
Answer: - Rep

8. Write down the value of CH, CL and DH registers on entry when intrupt 13H/3H is invoked? (3)
Answer: - (Page 42)
CH = Track # ,
CL = Sector #
DH = Head #

9.Write down the purpose of following commands: (5)


(a) outportb (0x61, inportb (0x61)|3);
(b) outportb (0x61, inportb (ox61) & 0xFC);

Answer: -
// Turn the speaker on setting the lowest two bits in port 61h.
outportb(0x61,inportb(0x61)|0x03);

// Turn the speaker off clearing the lowest two bits in port 61h.
outportb(0x61,inportb(0x61)&0xFC);

10. Why we need to convert cu\luster number into sector number? (5)
Answer: - (Page 258)
The user data area is divided into clusters. The first cluster in user data area is numbered 2 in a FAT based
systems. A cluster is not the same as block and also there are no system calls available which use the cluster
number. All the system calls use the LSN address. If the cluster number is known it should be converted into
LSN to access the blocks within the cluster. Moreover all the information about file management uses the
cluster number rather than the LSN for simplicity and for the purpose of managing large disk space.

11. How a chain of cluster in FAT12 is managed? (5)


Answer: - Rep

12. What are cross reference and how this problem can be solved? (5
Answer: - (Page 316)
• If a cluster lie in more than one file chain, then its said to be Cross Referenced.
• Cross references can pose great problems.
• Cross references can be detected easily by traversing through the chain of all files and marking the cluster #
during traversal.
• If a cluster is referenced more than once then it indicates a cross reference.
12
• To solve the problem only one reference should be maintained.

CS609 - Final Term Papers Spring 2012


Procedure of Converting cluster into sector
Answer: - Rep

GDT,LDT and IDT entries


Answer: - (Page 328)
• GDT: Global Descriptor Table
• LDT: Local Descriptor Table
• IDT: Interrupt Descriptor Table

Who to Convert cluster into sector in FAT32


Answer: - Rep

How we can read/write the disk block when LSN is given.

Which command is use befor changing the typematic rate and LED status.
Answer: - (Page 181)
If the device driver needs to change the status then the LED status byte should be written on the keyboard. But
before writing this byte the keyboard should be told that the control byte is to be written. This is done by sending the
code 0XED before sending the status byte using the above described protocol.

How we can convert Logical to Physical address translation


Answer: - Rep

Process of recover deleted content file


Answer: - Rep

Purpose of UART
Answer: - (Page 107)
The UART is a device used for asynchronous communications. UART is capable Of encapsulating a byte that might
be 5, 6, 7 or 8 bits wide in start and stop bits. Moreover it can attach an extra parity bit with the data for error
detection.

Convert cluster into sector in FAT12


Answer: - Rep

13
If a file size is 12K and the size of the cluster is 4K then clusters are used for the file.
Answer: -
3 clusters

CS609 - Final Term Papers Spring 2012


how can we access NTFS using BIOS() function
Answer: - (Page 310)
• If the system has booted in DOS then a NTFS volume can be accessed by an Indirect Method, using
BIOS functions..
• This technique makes use of physical addresses.
• Sector can be accessed by converting their LSN into LBA address and then using the LBA address in
extended BIOS functions to access the disk sectors.

what are selectors?


Answer: - Rep

write the max entries in FAT12 and FAT16.


Answer: - Rep

write the entries in FAT32


Answer: - Rep

surface area of disk size


Answer: - (Page 203)
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

write two main features of FAT12


Answer: - (Page 264)
• FAT is a simple table which contains cluster number of each file.
• FAT12 will have 12-bit wide entries and can have 2^12 entries maximum.
• Although some of these entries may be reserved.

Deleted Files using E5


Answer: - (Page 316)
DOS perform file deletion by placing 0xE5 at the first byte of it FCB entry and placing 0’s (meaning available)
in the entries for the file clusters in the FAT.

14
write the structure of root directory
Answer: - (Page 256)
The DOS directory structure is a Tree like structure. The top most level of the tree being the root directory. The root
directory contains files and folders. Each folder can contains more files and folders and so on it continues
recursively

what is mean by mode register in DMA


Answer: - (Page 187)
The Mode register is conveyed which Channel is to be programmed and for what purpose i.e. Read Cycle, Write Cycle,
Memory to memory transfer.

CS609 - Final Term Fall 2011

3) When delete file what happen to chain of cluster in FAT


Answer: - (Page 279)
Not only the file is marked for deletion but also the chain of its cluster in FAT is reclaimed by putting zeros in there
place. This also indicates that these clusters are now free.

5) What is highest capacity of disk using IDE and extended Bios Function?
Answer: - (Page 212)
• Hence highest physical capacity of the disk according to the IDE interface is
255x16x65536x512 = 127GB
•Extended BIOS functions allow to access disk with sizes greater than 504 MB through LBA translation.

3 Marks
In which media storage head touches the surface of the disk and why?
Answer: - (Page 206)

The head is touching the surface of floppy disk which rotates at a low speed of 300 RPM

How cross reference detects


Answer: - Rep

How LSN be translated into LBA


Answer: - (Page 311)
LBA = No. of Physical Blocks in other Partition + Hidden Blocks + LSN
All this information can be retrieved from the Partition Table + Boot Block

In DMA programming Model, what is the main purpose of base register? [2 Marks]
15
Answer: - (Page 197)
Before the channel is unmasked and the channel mode is programmed the base address the count and the higher 4 or
8 bits of the address should be placed in base register, count register and Latch B respectively.

From where, in partition table’s data part we can check the drive is bootable or not.
Answer: -
In the data part of partition table there are 16 byte code for each partition the first byte out of these 16 bytes
decide whether it is a bootable drive or not if value stored in this byte is 80h than it is a boot device and if zero
than it is not a boot device

Which data structure is derived from BPB and where it resides? [2 Marks]
Answer: - (Page 242)
BIOS parameter block is a data structure maintained by DOS in the boot block for each drive. The boot block is
typically a 512 byte block which as seen the previous slides is the first logical block i.e. LSN = 0. It contains
some code and data. The data part constitutes the BPB.

what is FAT12 and 32 entries size 2marks


Answer: -
FAT12
• FAT is a simple table which contains cluster number of each file.
• FAT12 will have 12-bit wide entries and can have 2^12 entries maximum.
• Although some of these entries may be reserved.

Fat32 Entry
•Each entry is of 32-bits size but only lower 28-bits are used.
•Higher 4-bits are not tempered.
•While reading higher 4-bits are ignored.
•While writing higher 4-bits are not changed.

What is a Descriptor 2marks


Answer: - (Page 326)

16
A Descriptor describes a Memory Segment by storing attributes related to a Memory Segment.
Significant attributes of a Memory Segment can be its base (starting) address, it length or limit and its access
rights.

17

You might also like