This program header in Figure 7.14 indicates that the data segment occupies 0x230 bytes in memory. However only the first 0x228 bytes of these come from the sections of the executable file. What causes this discrepancy?
Figure 7.14 Program header table for the example executable prog. off: offset in Object file; vaddr/paddr: memory address; align: alignment requirement; filesz: segment size in object file; mersz: segment size in memory; flags: run-time permissions.
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Computer Systems: A Programmer's Perspective Plus Mastering Engineering With Pearson Etext -- Access Card Package (3rd Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out with Python (4th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Concepts Of Programming Languages
Starting Out with Python (3rd Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
- Suppose that a 2 MB file consisting of 512-byte logical blocks is stored on a disk drive with the following characteristics: Parameter Value Rotational rate 15,000 RPMTavg seek 4 msAverage number of sectors/track 1,000Surfaces 8Sector size 512 bytes For each case below, suppose that a program reads the logical blocksof the file sequentially, one after the other, and that the time to positionthe head over the first block is Tavg seek + Tavg rotation .A. Best case: Estimate the optimal time (in ms) required to readthe file over all possible mappings of logical blocks to disksectors. B. Random case: Estimate the time (in ms) required to read thefile if blocks are mapped randomly to disk sectors.arrow_forwardWith the exception of fp being a file pointer rather than a file descriptor and the return value being an int status rather than a location, the standard library method int fseek(FILE *fp, long offset, int origin) is identical to Iseek. Compose fseek. Ensure that the caching used for the other library functions and your fseek are correctly coordinated.arrow_forwardA file whose file descriptor is fd contains the following sequence of bytes 3,1,4,1,5,9,2,6,5,3,5 Lseek (fd,3,SEEK_SET); read(fd,&buffer,4); Where the lseek call makes a seek to byte 3 of the file .what does buffer contain after the read has completed.arrow_forward
- Task: 1. Write a C program to simulate the sequential file allocation in a very simple file system. 2. Assume a disk of 32 blocks, each block is of 1 KB size 3. First 8 blocks (0 to 7) are allocated to the “iNodes” and can’t be used by the file system. Hence blocks available for allocation are from block 8 to block 31. 4. Minimum file size is 1 KB. Hence the file system can have minimum of one file of size 24 KB or maximum of 24 files. 5. At the start, it is assumed that the file system has no files. 6. The program shall ask the user to input the number of files to allocate and their respective names and file sizes. 7. The program shall randomly (set a seed with srand(seed) to replicate the randomness) select any free block as a start block. Check that the start block and the required contiguous blocks are free. If free, allocate those blocks to the file. If not free, find next available contiguous blocks. 8. After allocating blocks for all the files, the program shall print file name,…arrow_forwardSuppose a file named file1.txt stores five blocks of data, in blocks 2, 3, 5, 7, and 11 in a FAT-32 file system. (a) What does the directory entry for this file look like?(b) What do the FAT entries for this file look like?arrow_forwardSequential (contiguous) file allocation. Adding on to below C code to print the attached sample program output. #include<stdio.h>#include<stdlib.h>#define TOTAL_DISK_BLOCKS 32#define TOTAL_DISK_INODES 8int blockStatus[TOTAL_DISK_BLOCKS]; // free = 0int blockStart;struct file_table {char fileName[20];int startBlock;int fileSize;int allotStatus;};struct file_table fileTable[TOTAL_DISK_BLOCKS - TOTAL_DISK_INODES];int AllocateBlocks(int Size) {int i = 0, count = 0, inList = 0, nextBlock = 0;int allocStartBlock = TOTAL_DISK_INODES;int allocEndBlock = TOTAL_DISK_BLOCKS - 1;// check whether sufficient free blocks are availablefor (i = 0; i < (TOTAL_DISK_BLOCKS - TOTAL_DISK_INODES); i++)if (blockStatus[i] == 0)count++;if (count < Size)return 1; // not enough free blockscount = 0;while (count < Size) {nextBlock = (rand() % (allocEndBlock - allocStartBlock + 1)) + allocStartBlock;for (i = nextBlock; i < (nextBlock + Size); i++){if (blockStatus[i] == 0)count = count +…arrow_forward
- Assume that each block has B = 1000 Bytes, and the buffer pool has m = 1001 frames. What is theexact size of the largest file external memory sorting can sort within 3 passes, i.e., pass 0 to pass 2with pass 2 producing only 1 run?arrow_forward2. Write a program that opens a file in read-only mode and maps the entire file into the virtual-memory address space using mmap. The program should search through the bytes in the mapped region, testing whether any of them is equal to the character X. As soon as an X is found, the program should print a success message and exit. If the entire file is searched without finding an X, the program should report failure. Time your program on files of varying size, some of which have an X at the beginning, while others have an X only at the end or not at all. Please write the program in Carrow_forwardRead question properly and give correct answer fastttt within 30 minutes.... will upvote Answer the questions below using the following information: Consider a disk with block size B = 512 bytes. A block pointer is P = 6 bytes long, and a record pointer is PR = 7 bytes long. A file has r = 30,000 EMPLOYEE records of fixed length. Each record hs the following fields: Name (30 bytes), SSN (9 bytes), Department_code (9 bytes), Address (40 bytes), Phone (9 bytes), Birth_date (8 bytes), Sex (1 byte), Job_code (4 bytes), Salary (4 bytes, real number). An additional byte is used as a deletion marker. Suppose that the file is not ordered by the key field SSN and we want to construct a B+-tree access structure (index) on SSN. Calculate: The orders p and pleaf of the B+-treeThe number of leaf-level blocks needed if blocks are approximately 69 percent full (rounded up for convenience)The number of levels needed if internal nodes are also 69 percent full (also rounded up)The total number of blocks…arrow_forward
- Consider a Data file of r=30,000 EMPLOYEE records of fixed-length, consider a disk with block size B=512 bytes. A block pointer is P=6 bytes long and a record pointer is P R =7 bytes long. Each record has the following fields: NAME (30 bytes), SSN (9 bytes), DEPARTMENTCODE (9 bytes), ADDRESS (40 bytes), PHONE (9 bytes), BIRTHDATE (8 bytes), SEX (1 byte), JOBCODE (4 bytes), SALARY (4 bytes, real number). An additional byte is used as a deletion marker. Calculate the record size R in bytes. Calculate the blocking factor bfr and the number of file blocks b assuming an unspanned organization. Suppose the file is ordered by the key field SSN and we want to construct a primary index on SSN. Calculate the index blocking factor bfr .arrow_forward[11:43 PM, 7/23/2022] +254 719 743842: The purpose of this assignment is to learn to develop multi-process programs. You are expected to extend the myshell.c program and add pipelines and I/O redirections. In particular, your shell program should recognize the following: > - Redirect standard output from a command to a file. Note: if the file already exists, it will be erased and overwritten without warning. For example, COP4338$ ls > 1COP4338$ sort myshell.c > 2Note that you're not supposed to implement the Unix commands (ls, sort, ...). You do need to implement the shell that invoke these commands and you need to "wire" up the standard input and output so that they "chain" up as expected. >> - Append standard output from a command to a file if the file exists; if the file does not exist, create one. For example, COP4338$ sort myshell.c >> 1COP4338$ echo "Add A Line" >> 1< - Redirect the standard input to be from a file, rather than the keyboard. For…arrow_forward1.What is the primary goal in using a scripting language for programming work? 1.Write a shell program that counts the number of files in a given directory. Thedirectory should be specified as a command line argument. The program doesnot need to count files recursively in subdirectories; instead, it should not count subdirectories at all.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr