CFS264_HW5

docx

School

Metropolitan State University Of Denver *

*We aren’t endorsed by this school

Course

264

Subject

Mechanical Engineering

Date

Apr 3, 2024

Type

docx

Pages

3

Uploaded by ProfTrout4139

Report
CFS264 Computer and Operating Systems Fundamentals II Page 1 of 3 Homework 5 _____________________________________________________________________________________ Please note: combine your homework into one (1) Word or PDF file and submit in D2L submission folder designated for this assignment. You may earn up to 20 points for completing this assignment. Part I (10 points) Based on the textbook: Modern Operating Systems , answer the following questions (if the page/problem numbers are different in your book, use the text below): 1. Page 429, Problem 4 Explain the tradeoffs between precise and imprecise interrupts on a superscalar machine. Precise interrupts the CPU to carefully log everything it is doing and maintain shadow copies of registers; this makes the overall performance for precise interrupts slower. Enabling backward compatibility with precise interrupts is complex interrupt logic. The system must be notified when an interrupt is occurring so that any changes will not have an effect after the interrupt. Although it doesn’t make the performance slower, it takes up more chip area and is more complex in design. For Imprecise interrupts, The Programmer must figure out where the fault occurred which is a daunting task considering the process that concurrently run. It typically spits out large amounts of information to help the programmer find the fault. The problem is the large amount of information’s make the interrupt slow and recovery even slower. Fast superscalar machines are turned into slow unusable computers due to this. 2. Page 431, Problem 23 How many pebibytes are there in a zebibyte? 1048576 Part II (10 points) Based on the information on previous handouts, answer the following questions: Problem 1: Please write a shell script called “ checkfile ”, that checks a file provided from the command line by the user to determine whether it is a regular file. If it is a regular file, your script should go further to determine whether it is readable and executable. Your script should display the information on each checking step it makes, such as “The file is a regular file” or “The file is a readable file,” etc. Please test your script to make sure it displays the information as required; Please provide the code of your script and the output of your script to show it meets the requirements. Input : !/bin/bash _____________________________________________________________________________________ Please submit your homework in one (1) file in D2L on time
CFS264 Computer and Operating Systems Fundamentals II Page 2 of 3 Homework 5 _____________________________________________________________________________________ FILE = $1 if [ -f "$FILE" ]; then echo "File $FILE is a regular file." if [ -r "$FILE" ]; then echo "File $FILE is readable." else echo "File $FILE is NOT readable." fi if [ -x "$FILE" ]; then echo "File $FILE is executable." else echo "File $FILE is NOT executable." fi else echo "File $FILE is NOT a regular file or does not exist." Fi Output: bash ./checkfile.sh test2 File test2 is a regular file. File test2 is readable. File test2 is NOT executable. Problem 2: Please write a shell script called “ myforloop ” that displays all the readable file(s) under your lab5 ” directory, such as my2, my3, and my4 . You must use a for-loop in your script. You might want to test all the examples of for-loop provided in the handout to see which one matches your need; Please test your script to make sure it displays the information as required; Please provide the code of your script and the output of your script to show it meets the requirements. Input: #!/bin/bash directory = "." if [ -d "$directory" ]; then for file in "$directory" /* ; do if [ -r "$file" ]; then echo "Readable file: $file" fi done else echo "Directory $directory not found." Fi _____________________________________________________________________________________ Please submit your homework in one (1) file in D2L on time
CFS264 Computer and Operating Systems Fundamentals II Page 3 of 3 Homework 5 _____________________________________________________________________________________ Output : cfs264sp2442@sp-cfsics : ~/lab5 $ ./myforloop.sh Readable file: ./my2 Readable file: ./my3 Readable file: ./my4 Readable file: ./myforloop.sh Readable file: ./shellsc After you complete, please copy and paste everything (you commands, the outputs, the content of files, and etc.) into one file. If a screen shot is necessary, please include it in this file too. _____________________________________________________________________________________ Please submit your homework in one (1) file in D2L on time
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help