Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 6, Problem 6.24HW
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 RPM |
Seek | 4 ms |
Average number of sectors/track | 1,000 |
Surfaces | 8 |
Sector size | 512 bytes |
For each case below, suppose that a program reads the logical blocks of the file sequentially, one after the other, and that the time to position the head over the first block is Tavg seek + Tavg rotation.
- A. Best case: Estimate the optimal time (in ms) required to read the file over all possible mappings of logical blocks to disk sectors.
- B. Random case: Estimate the time (in ms) required to read the file if blocks are mapped randomly to disk sectors.
Expert Solution & Answer
Learn your wayIncludes step-by-step video
schedule05:48
Students have asked these similar questions
This Python
Lab 9
Lab: Write a file copying program. The program asks for the name of the file to copy from (source file) and the name of the file to copy to (destination file). The program opens the source file for reading and the destination file for writing. As the program reads each line from the source file and it writes the line to the destination file. When every line from the source file has been written to the destination file, it close both files and print “Copy is successful.”
In the sample run, “add.py” is the source file and “add-copy.py” is the destination file. Note that both “add-copy.py” is identical to “add.py” because “add-copy.py” is a copy of “add.py”.
Sample run:
Enter file to copy from: add.py
Enter file to copy to : add-copy.py
Copy is successful.
Source file: add.py
print("This program adds two numbers")
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
print(f"{a} + {b} = {a+b}")
Destination file:…
Given a JSON file, read the data and complete the following:
Open the JSON file and read the contents into a variable (aka memory)
Sort the characters by the dob key
Loop through each character and output the sentence in the following format
Admiral Jonathan Archer was born on October 09, 2112 and first appeared in Enterprise
The sentence in the print() statement should be a single string statement, no commas seperating values
Research how to use the sorted() method to sort your dictionaries by a specific key
work for far:
# Define Main Program
import json
def main():
with open('x:/json_file.json') as file_object:
data = json.load(file_object)
print(data)
pass
# DO NOT MODIFY BELOW
if __name__ == "__main__":
# Call Main Program
main()
data.Json
{ "characters": [ { "name_first": "Jonathan", "name_last": "Archer", "rank": "Admiral", "dob": "21121009", "series": "Star Trek: Enterprise" }, { "name_first": "Michael", "name_last": "Burnham", "rank":…
Contiguous Memory Allocation Algorithms
The program will read size of free memory partitions and size of processes from a text file and then will try to allocate a memory partition for each process using the first-fit, best-fit and worst-fit allocation algorithms.
The implementation completed in Python programming language.
The first line of the input file should contain the size of free memory partitions (in order) while the second line contains the size of processes (in order). Sample input file is shown below:
300,600,350,200,750,125
115,500,358,200,375
The program should read the name input file as command line input and produce a text file named “output.txt” with the following example output:
First-Fit Memory Allocation
-----------------------------------------------------------------------------------------------
start => 300 600 350 200 750 125
115 => 115* 185 600 350 200 750 125
500 => 115* 185 500* 100 350 200 750 125
358…
Chapter 6 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Ch. 6.1 - Prob. 6.1PPCh. 6.1 - Prob. 6.2PPCh. 6.1 - Prob. 6.3PPCh. 6.1 - Prob. 6.4PPCh. 6.1 - Prob. 6.5PPCh. 6.1 - Prob. 6.6PPCh. 6.2 - Prob. 6.7PPCh. 6.2 - Prob. 6.8PPCh. 6.4 - Prob. 6.9PPCh. 6.4 - Prob. 6.10PP
Ch. 6.4 - Prob. 6.11PPCh. 6.4 - Prob. 6.12PPCh. 6.4 - Prob. 6.13PPCh. 6.4 - Prob. 6.14PPCh. 6.4 - Prob. 6.15PPCh. 6.4 - Prob. 6.16PPCh. 6.5 - Prob. 6.17PPCh. 6.5 - Prob. 6.18PPCh. 6.5 - Prob. 6.19PPCh. 6.5 - Prob. 6.20PPCh. 6.6 - Prob. 6.21PPCh. 6 - Prob. 6.22HWCh. 6 - Prob. 6.23HWCh. 6 - Suppose that a 2 MB file consisting of 512-byte...Ch. 6 - The following table gives the parameters for a...Ch. 6 - The following table gives the parameters for a...Ch. 6 - Prob. 6.27HWCh. 6 - This problem concerns the cache in Practice...Ch. 6 - Suppose we have a system with the following...Ch. 6 - Suppose we have a system with following...Ch. 6 - Suppose that a program using the cache in Problem...Ch. 6 - Repeat Problem 6.31 for memory address0x16E8 A....Ch. 6 - Prob. 6.33HWCh. 6 - Prob. 6.34HWCh. 6 - Prob. 6.35HWCh. 6 - Prob. 6.36HWCh. 6 - Prob. 6.37HWCh. 6 - Prob. 6.38HWCh. 6 - Prob. 6.39HWCh. 6 - Given the assumptions in Problem 6.38, determine...Ch. 6 - You are writing a new 3D game that you hope will...Ch. 6 - Prob. 6.42HWCh. 6 - Prob. 6.43HWCh. 6 - Prob. 6.45HWCh. 6 - Prob. 6.46HW
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
(Catch Parameter) Under what circumstances would you not provide a parameter name when defining the type of the...
C How to Program (8th Edition)
For each of the following E-R diagrams from Chapter 2 C: Transform the diagram to a relational schema that show...
Modern Database Management
Write code that displays the contents of the int variable i in binary, hexadecimal, and octal.
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
What will the following code display? stuff = {1 : 'aaa', 2 : 'bbb', 3 : ccc} for k in stuff: print(k)
Starting Out with Python (4th Edition)
The article mentions that quantum computers will have tremendous processing power and revolutionize a number of...
Using MIS (10th Edition)
1. Read the problem statement. 2. Formulate the algorithm using pseudocode and top-down, stepwise refinement. 3...
Java How To Program (Early Objects)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Problem 0. Suppose a file contains 100 bytes of data. A program successfully opens it for both reading and writing (i.e., passing the mode O_READWR to open()), and gets back a file descriptor number fd. a. The program, which has a 40-byte buffer, issues a call to read() for 40 bytes. It processes that data, and then repeats the call. Both calls return the exact amount requested. Then it issues a third read, again requesting 40 bytes. What value will it return? (Assume no other program has the file open.) b. Next the program calls write (fd, buffer, 40), and the call returns 40. Then it issues another read() call for 40 bytes. What value does that call return? c. Suppose the programmer needs to read back the 40 bytes just written. First it must use 1seek() to reposition the file pointer. What parameters should it invoke 1seek () with so that the next read call will return the 40 bytes just written?arrow_forwardDesign a pseudocode algorithm for reversing the contents of a text file into another file. Assume that the amount of memory is limited, so that you cannot read the entire source file into memory before you start writing it to a second file in reverse order.arrow_forwardWrite an algorithm of a program to read from a file. The user should be able to get the option to input the file name. He is supposed to read first 100 bytes from the file. After the reading is done, the file should be closed. If the file is not available, the program should be closed immediately. You should mention "System call" beside each instruction which are supposed to use a system call function.arrow_forward
- 1 Encryption (a). Write a program that will utilise AES for encrypting and decrypting the data from a file as follows. Your program should take 3 arguments from the command line as input. The first input should be either 0 or 1 referring to encryption or decryption, respectively. The second input is the key filename. The third input is the either the plaintext or encrypted filename. If the first argument is 0: your program will read an AES key from a file titled key.txt (passed as second argument) and then will read the plaintext from a file titled plain- text.txt (passed as third argument), encrypt the contents of plaintext.txt using the key and save the ciphertext in a file titled encrypted.txt. If the first argument is 1, your program should decrypt the contents of encrypted.txt. Sample Command-line Inputs: java 0 key.txt plaintext.txt java 1 key.txt encrypted.txtarrow_forwardPlease solve the following in Java Sean can't remember where he put an important file on his computer. He desperately needs the file tonight to finish his homework, since he procrastinated all day by playing computer games. Unfortunately, his computer has gotten fried from all the gaming, and can no longer perform automatic searches for files. He therefore has to look for the file manually.Since he tends not to use subdirectories too much,he knows his best bet is to look for the file first in the root directory ("/"), and next in directories only one level deep (for example, "/Games/"), and so forth, checking the "deepest" directories last. His computer still has enough fire power to run some simple programs, so he has asked you to code for him a simple algorithm to sort all of the directories on his computer. ThealgorithmshouldtakeaString[]dirsasaninputand should sort dirs first by directory depth, and then lexicographically for each depth. So "/d/e/" comes before "/a/b/c/", but not…arrow_forwardInput This program will create a date in the Microsoft Disk Operating System File Allocation Table (DOS FAT) date format. You should write a sequence of instructions which receives three variables in registers as input: M - a month between 1 and 12 (in register 1) D - a day between 1 and 31 (in register 2) Y - a four-digit year value between 1980 and 2127 inclusive (in register 3) Processing: You must start by validating that these values are all within the appropriate ranges (1-12, 1-31, 1980-2127). If not, place a value of minus one in register 0 and end the program. Then use shift and bitwise instructions to create a Microsoft DOS FAT file system date. This has the format: Year in bits 15..09 Month in bits 08..05 Day in bits 04..00 This is a 16-bit number. The upper bits (31..16) should be set to zero. Output: Output shall be placed in register zero. If any of the parameters are invalid, place a value of minus one in register 0. Grading: Correct output values for selected…arrow_forward
- Goal:Experimenting with AES-128 symmetric key cipher. Note:Using Python programming language that provided libraries for AES. Description:PART 1: write a program that uses AES-128 to decrypt a message. The program should be named "decrypt", and should deal with three files that contain the encrypted text as a stream of bytes, the 128-bit key for decryption stored as a stream of bytes, and the outcome of the decryption, respectively.- To test this program, here's an example of an encrypted message (ciphertext.dat) and its 128-bit secret key (key.dat). PART 2: you will try to use "brute force" to decrypt an encrypted message, where you only have the first 96-bits of the 128-bit secret key (last 4 bytes of the secret key are missing!) The program should be called "findk", and should deal with two files that contain the encrypted text as a stream of bytes and the first 96-bits of the key, respectively. The program should print out on standard output the missing 4 bytes of the key in…arrow_forwardIn python, rite a recursive function, displayFiles, that expects a pathname as an argument. The path name can be either the name of a file or the name of a directory. If the pathname refers to a file, its filepath is displayed, followed by its contents, like so: File name: file_path Lorem ipsum dolor sit amet, consectetur adipiscing elit... Otherwise, if the pathname refers to a directory, the function is applied to each name in the directory, like so: Directory name: directory_path File name: file_path1 Lorem ipsum dolor sit amet... File name: file_path2 Lorem ipsum dolor sit amet... ... Test this function in a new program.arrow_forwardI need a PSEUDOCODE for this problem: Phresh Ladies Makeup Line and We are Ladies Co. are merging their businesses and want to merge their product files. Each file contains a product number, name, quantity, and price, and each file is arranged by product number accordingly. Design the logic for a program using pseudocode that merges the two files into one file containing all products. Assume that all product numbers are unique.arrow_forward
- USE PYTHON Python already supports math, whereby you can write code to add, subtract, multiply, or divide values and even variables. But let’s write a program that enables users to do math, even without knowing Python. In a file called interpreter.py, implement a program that prompts the user for an arithmetic expression and then calculates and outputs the result as a floating-point value formatted to one decimal place. Assume that the user’s input will be formatted as x y z, with one space between x and y and one space between y and z, wherein: x is an integer y is +, -, *, or / z is an integer For instance, if the user inputs 1 + 1, your program should output 2.0. Assume that, if y is /, then z will not be 0. Note that, just as python itself is an interpreter for Python, so will your interpreter.py be an interpreter for math! Please see 2 attached photos for demo and Test program. **USE PYTHON** THANKSarrow_forwardUsing only standard I/O functions (like fopen(), fseek(), ftell(), fgets(), etc.), write a C program to reverse the order of the lines in a text file. That is the first line becomes last, the second line becomes the one before the last one and so on. Note: your program should have two arguments, the input file name and the output file name. Call model: reverseFile Input file:HelloI am happy to see youOutput file:I am happy to see youHelloarrow_forwardPYTHON-Assume you have a file that has two columns separated by a comma. The first column contains gene accession numbers, and the second column contain their nucleotide sequence. For example: ABC123, AAGTCTTCCCTAAGCCC... KHJ456, TTCGGTCATACTATTC... NMG789, GCTACTCGATGCTA.... .... The file can contain any number of rows. Write a program that reads in this file (you can create one to test your code with, use TextEdit or Notepad) and creates a dictionary, where the keys are the accession numbers and the values are the sequences. Print out to the screen the dictionary pairs that you created.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Instruction Format (With reference to address); Author: ChiragBhalodia;https://www.youtube.com/watch?v=lNdy8HREvgo;License: Standard YouTube License, CC-BY