SlideShare a Scribd company logo
1 of 21
LMP1: I/O and Filesystems
=========================
Welcome to LMP1, the first long MP. LMP1 is the first stage
of a project aimed
at creating a simple yet functional networked filesystem. In
this MP, you will
learn about and use POSIX file system calls, while subsequent
LMPs will
introduce memory management, messaging, and networking
functionality. If you
implement all parts of this MP correctly, you will be able to
reuse your code
for future MPs.
This first LMP concentrates on the file I/O portion of the
project.
Specifically, you will implement a custom filesystem and test
its performance
using a filesystem benchmark. A benchmark is an application
used to test the
performance of some aspect of the system. We will be using
Bonnie, a real
filesystem benchmark, to test various performance aspects of
the filesystem we
implement.
LMP1 consists of four steps:
1. Read the code; run the Bonnie benchmark and the LMP1 test
suite.
2. Implement Test Suite 1 functionality, encompassing basic file
I/O operations.
3. Implement Test Suite 2-4 functionality (directory operations,
file
creation/deletion, and recursive checksumming).
4. Modify Bonnie to use your client-server file I/O methods.
Code structure
--------------
The code for this project is structured according to the client-
server
model. The client code (filesystem benchmark) will interact
with the
server (filesystem) only through interface functions defined in
fileio.h:
int file_read(char *path, int offset, void *buffer, size_t
bufbytes);
int file_info(char *path, void *buffer, size_t bufbytes);
int file_write(char *path, int offset, void *buffer, size_t
bufbytes);
int file_create(char *path,char *pattern, int repeatcount);
int file_remove(char *path);
int dir_create(char *path);
int dir_list(char *path,void *buffer, size_t bufbytes);
int file_checksum(char *path);
int dir_checksum(char *path);
These functions represent a simple interface to our filesystem.
In Steps 2 and
3 of this MP, you will write the code for functions
implementing this interface,
replacing the stub code in fileio.c. In Step 4, you will modify a
Bonnie method
to use this interface, rather than calling the normal POSIX I/O
functions
directly. The purpose of Step 4 is to help test our
implementation.
Step 1: Understanding the code
------------------------------
1. Compile the project, execute Bonnie and the test framework.
Note: you may need to add execute permissions to the .sh files
using
the command "chmod +x *.sh".
Try the following:
make
./lmp1
(this runs the Bonnie benchmark - it may take a little while)
./lmp1 -test suite1
(run Test Suite 1 - this has to work for stage1)
make test
(run all tests - this has to work for stage2)
2. Read through the provided .c and .h files and understand how
this
project is organized:
bonnie.c - a version of the filesystem benchmark
fileio.c - file I/O functions to be implemented
fileio.h - declaration of file I/O functions
restart.c - restart library (available for use in fileio.c)
restart.h - declaration of restart library functions
util.c - useful utility functions
util.h - declaration of useful utility functions and macros
In particular, pay close attention to the comments in fileio.h and
bonnieb.c. You should understand what each of the following
functions
in bonnie.c does before undertaking the remainder of the MP:
fill_file_char()
file_read_rewrite()
file_read_rewrite_block()
fill_file_block()
fill_read_getc()
file_read_chunk()
newfile()
Step 2: Basic I/O operations
----------------------------
Implement file_read, file_write and file_info operations in
fileio.c.
If done correctly, your code should pass all suite1 tests:
./lmp1 -test suite1
Running tests...
1.read ::pass
2.info ::pass
3.write ::pass
Test Results:3 tests,3 passed,0 failed.
IMPORTANT: fileio.c is the only file you should modify for
this step.
Step 3: More filesystem operations
----------------------------------
Implement file and directory operations for suite2 (dir_create
and
dir_list), suite3 (file_create and file_remove), and suite4
(file_checksum and dir_checksum).
You can test each operation and test suite individually:
./lmp1 -test dirlist
./lmp1 -test suite2
All tests should now pass:
make test
Running tests...
1.read ::pass
2.info ::pass
3.write ::pass
4.dirlist ::pass
5.dircreate ::pass
6.remove ::pass
7.create ::pass
8.filechecksum ::pass
9.dirchecksum ::pass
Test Results:9 tests,9 passed,0 failed.
Step 4: Performance testing
---------------------------
In this step, we will change parts of Bonnie to use our
filesystem
interface.
Make the function file_read_rewrite_block() in bonnie.c to call
your
fileio.c functions instead of POSIX I/O operations. When
answering the
questions below, use this modified version of bonnie.c.
Before making this change, it's a good idea to write pseudocode
comments
for what each part of file_read_rewrite_block() does, so that
you
understand the code and can perform the change correctly.
There may
not be an exact one-to-one correspondence between our
filesystem
interface and the POSIX commands.
Note: In future LMPs, we will be using the fileio.h interface in
a
similar manner, but we will call the functions remotely, via a
message
queue.
Questions
---------
Q1. Briefly explain what the following code from bonnie.c
does:
if ((words = read(fd, (char *) buf, Chunk)) == -1) ...
Q2. Is the above an example of a block read or a character read?
What
is the value of the variable 'words' if the read succeeds? Fails?
Q3. Explain the meaning of the flag value (O_CREAT |
O_WRONLY |
O_APPEND) for the POSIX function open().
Q4. Run Bonnie. What is being measured by each test function?
Q5. Look at the summary results from the Bonnie run in Q4.
Does Bonnie
measure latency, throughput or something else? Justify your
answer.
Q6. Compare character reads with block reads using Bonnie.
Which is
faster? Why do you think this is the case?
Q7. Copy and paste the performance measures output when
running Bonnie
benchmarks in a local directory and again in an NFS-mounted
directory.
Is one kind of disk access noticeably slower over the network,
or are
all tests significantly slower?
Your home directory may be an NFS mount, whereas /tmp and
/scratch are local
disks. To test your code in /tmp, do the following:
mkdir /tmp/your_username
cp lmp1 /tmp/your_username
cd /tmp/your_username
./lmp1
(record the output)
cd
rm -fr /tmp/your_username
Q8. How does Bonnie handle incomplete reads, e.g., due to
interruptions
from signals? Justify why Bonnie's approach is good or bad for
a
filesystem benchmark program.
Q9. By now you should be very familiar with the self-evaluation
test
harness we provide for the MPs. Examine the function
test_file_read()
in lmp1_tests.c, which tests your file_read() function from Step
2.
What does this test check for, specifically? You may want to
copy and
paste the code for this function in your answer, and annotate
each
quit_if or group of related quit_ifs with a comment.
LMP2: Memory Management
=======================
This machine problem will focus on memory. You will
implement your own
version of malloc() and free(), using a variety of allocation
strategies.
You will be implementing a memory manager for a block of
memory. You will
implement routines for allocating and deallocating memory, and
keeping track of
what memory is in use. You will implement four strategies for
selecting in
which block to place a new requested memory black:
1) First-fit: select the first suitable block with smallest
address.
2) Best-fit: select the smallest suitable block.
3) Worst-fit: select the largest suitable block.
4) Next-fit: select the first suitable block after
the last block allocated (with wraparound
from end to beginning).
Here, "suitable" means "free, and large enough to fit the new
data".
Here are the functions you will need to implement:
initmem():
Initialize memory structures.
mymalloc():
Like malloc(), this allocates a new block of memory.
myfree():
Like free(), this deallocates a block of memory.
mem_holes():
How many free blocks are in memory?
mem_allocated():
How much memory is currently allocated?
mem_free():
How much memory is NOT allocated?
mem_largest_free():
How large is the largest free block?
mem_small_free():
How many small unallocated blocks are currently in memory?
mem_is_alloc():
Is a particular byte allocated or not?
We have given you a structure to use to implement these
functions. It is a
doubly-linked list of blocks in memory (both allocated and free
blocks). Every
malloc and free can create new blocks, or combine existing
blocks. You may
modify this structure, or even use a different one entirely.
However, do not
change function prototypes or files other than mymem.c.
IMPORTANT NOTE: Regardless of how you implement
memory management, make sure
that there are no adjacent free blocks. Any such blocks should
be merged into
one large block.
We have also given you a few functions to help you monitor
what happens when you
call your functions. Most important is the try_mymem()
function. If you run
your code with "mem -try ", it will call this function, which you
can use
to demonstrate the effects of your memory operations. These
functions have no
effect on test code, so use them to your advantage.
Running your code:
After running "make", run
1) "mem" to see the available tests and strategies.
2) "mem -test " to test your code with our tests.
3) "mem -try " to run your code with your own tests
(the try_mymem function).
You can also use "make test" and "make stage1-test" for testing.
"make
stage1-test" only runs the tests relevant to stage 1.
As in previous MPs, running "mem -test -f0 ..." will allow tests
to run even
after previous tests have failed. Similarly, using "all" for a test
or strategy
name runs all of the tests or strategies. Note that if "all" is
selected as the
strategy, the 4 tests are shown as one.
One of the tests, "stress", runs an assortment of randomized
tests on each
strategy. The results of the tests are placed in "tests.out" . You
may want to
view this file to see the relative performance of each strategy.
Stage 1
-------
Implement all the above functions, for the first-fit strategy. Use
"mem -test
all first" to test your implementation.
Stage 2
-------
A) Implement the other three strategies: worst-fit, best-fit, and
next-fit. The
strategy is passed to initmem(), and stored in the global variable
"myStrategy".
Some of your functions will need to check this variable to
implement the
correct strategy.
You can test your code with "mem -test all worst", etc., or test
all 4 together
with "mem -test all all". The latter command does not test the
strategies
separately; your code passes the test only if all four strategies
pass.
Questions
=========
1) Why is it so important that adjacent free blocks not be left as
such? What
would happen if they were permitted?
2) Which function(s) need to be concerned about adjacent free
blocks?
3) Name one advantage of each strategy.
4) Run the stress test on all strategies, and look at the results
(tests.out).
What is the significance of "Average largest free block"?
Which strategy
generally has the best performance in this metric? Why do you
think this is?
5) In the stress test results (see Question 4), what is the
significance of
"Average number of small blocks"? Which strategy generally
has the best
performance in this metric? Why do you think this is?
6) Eventually, the many mallocs and frees produces many small
blocks scattered
across the memory pool. There may be enough space to allocate
a new block, but
not in one place. It is possible to compact the memory, so all
the free blocks
are moved to one large free block. How would you implement
this in the system
you have built?
7) If you did implement memory compaction, what changes
would you need to make
in how such a system is invoked (i.e. from a user's perspective)?
8) How would you use the system you have built to implement
realloc? (Brief
explanation; no code)
9) Which function(s) need to know which strategy is being
used? Briefly explain
why this/these and not others.
10) Give one advantage of implementing memory management
using a linked list
over a bit array, where every bit tells whether its corresponding
byte is
allocated.
LMP1 IO and Filesystems=========================Welcome .docx

More Related Content

Similar to LMP1 IO and Filesystems=========================Welcome .docx

CEIS106_Final_Project.pptx.pdf
CEIS106_Final_Project.pptx.pdfCEIS106_Final_Project.pptx.pdf
CEIS106_Final_Project.pptx.pdfluxasuhi
 
CR based development in Synergy
CR based development in SynergyCR based development in Synergy
CR based development in SynergyManageware
 
Exploit Frameworks
Exploit FrameworksExploit Frameworks
Exploit Frameworksphanleson
 
L lpic1-v3-103-1-pdf
L lpic1-v3-103-1-pdfL lpic1-v3-103-1-pdf
L lpic1-v3-103-1-pdfhellojdr
 
Composite applications tutorial
Composite applications tutorialComposite applications tutorial
Composite applications tutorialdominion
 
IBM Enterprise 2014 - Technical University Abstract Guide
IBM Enterprise 2014 - Technical University Abstract GuideIBM Enterprise 2014 - Technical University Abstract Guide
IBM Enterprise 2014 - Technical University Abstract GuideCasey Lucas
 
SMP4 Thread Scheduler======================INSTRUCTIONS.docx
SMP4 Thread Scheduler======================INSTRUCTIONS.docxSMP4 Thread Scheduler======================INSTRUCTIONS.docx
SMP4 Thread Scheduler======================INSTRUCTIONS.docxpbilly1
 
C++ Restrictions for Game Programming.
C++ Restrictions for Game Programming.C++ Restrictions for Game Programming.
C++ Restrictions for Game Programming.Richard Taylor
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox testsKevin Beeman
 
Programming in c_in_7_days
Programming in c_in_7_daysProgramming in c_in_7_days
Programming in c_in_7_daysAnkit Dubey
 
ECET 360 help A Guide to career/Snaptutorial
ECET 360 help A Guide to career/SnaptutorialECET 360 help A Guide to career/Snaptutorial
ECET 360 help A Guide to career/Snaptutorialpinck2380
 
ECET 360 help A Guide to career/Snaptutorial
ECET 360 help A Guide to career/SnaptutorialECET 360 help A Guide to career/Snaptutorial
ECET 360 help A Guide to career/Snaptutorialpinck200
 
fileop report
fileop reportfileop report
fileop reportJason Lu
 
Testing in Craft CMS
Testing in Craft CMSTesting in Craft CMS
Testing in Craft CMSJustinHolt20
 

Similar to LMP1 IO and Filesystems=========================Welcome .docx (20)

CEIS106_Final_Project.pptx.pdf
CEIS106_Final_Project.pptx.pdfCEIS106_Final_Project.pptx.pdf
CEIS106_Final_Project.pptx.pdf
 
Mac
MacMac
Mac
 
Introduction to Makefile
Introduction to MakefileIntroduction to Makefile
Introduction to Makefile
 
Matlab m files
Matlab m filesMatlab m files
Matlab m files
 
Readme
ReadmeReadme
Readme
 
Unix commands
Unix commandsUnix commands
Unix commands
 
CR based development in Synergy
CR based development in SynergyCR based development in Synergy
CR based development in Synergy
 
Exploit Frameworks
Exploit FrameworksExploit Frameworks
Exploit Frameworks
 
L lpic1-v3-103-1-pdf
L lpic1-v3-103-1-pdfL lpic1-v3-103-1-pdf
L lpic1-v3-103-1-pdf
 
Composite applications tutorial
Composite applications tutorialComposite applications tutorial
Composite applications tutorial
 
IBM Enterprise 2014 - Technical University Abstract Guide
IBM Enterprise 2014 - Technical University Abstract GuideIBM Enterprise 2014 - Technical University Abstract Guide
IBM Enterprise 2014 - Technical University Abstract Guide
 
SMP4 Thread Scheduler======================INSTRUCTIONS.docx
SMP4 Thread Scheduler======================INSTRUCTIONS.docxSMP4 Thread Scheduler======================INSTRUCTIONS.docx
SMP4 Thread Scheduler======================INSTRUCTIONS.docx
 
C++ Restrictions for Game Programming.
C++ Restrictions for Game Programming.C++ Restrictions for Game Programming.
C++ Restrictions for Game Programming.
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox tests
 
Programming in c_in_7_days
Programming in c_in_7_daysProgramming in c_in_7_days
Programming in c_in_7_days
 
ECET 360 help A Guide to career/Snaptutorial
ECET 360 help A Guide to career/SnaptutorialECET 360 help A Guide to career/Snaptutorial
ECET 360 help A Guide to career/Snaptutorial
 
ECET 360 help A Guide to career/Snaptutorial
ECET 360 help A Guide to career/SnaptutorialECET 360 help A Guide to career/Snaptutorial
ECET 360 help A Guide to career/Snaptutorial
 
fileop report
fileop reportfileop report
fileop report
 
Testing in Craft CMS
Testing in Craft CMSTesting in Craft CMS
Testing in Craft CMS
 
Database Management Assignment Help
Database Management Assignment Help Database Management Assignment Help
Database Management Assignment Help
 

More from manningchassidy

Living in a Sustainable WorldImagine a future in which human bei.docx
Living in a Sustainable WorldImagine a future in which human bei.docxLiving in a Sustainable WorldImagine a future in which human bei.docx
Living in a Sustainable WorldImagine a future in which human bei.docxmanningchassidy
 
LO Analyze Culture and SocialDiscuss the concepts in this c.docx
LO Analyze Culture and SocialDiscuss the concepts in this c.docxLO Analyze Culture and SocialDiscuss the concepts in this c.docx
LO Analyze Culture and SocialDiscuss the concepts in this c.docxmanningchassidy
 
Literature Review Project.Assignment must comply with APA 7th ed.docx
Literature Review Project.Assignment must comply with APA 7th ed.docxLiterature Review Project.Assignment must comply with APA 7th ed.docx
Literature Review Project.Assignment must comply with APA 7th ed.docxmanningchassidy
 
lobal Commodity Chains & Negative ExternalitiesThe worldwide n.docx
lobal Commodity Chains & Negative ExternalitiesThe worldwide n.docxlobal Commodity Chains & Negative ExternalitiesThe worldwide n.docx
lobal Commodity Chains & Negative ExternalitiesThe worldwide n.docxmanningchassidy
 
Livy, ​History of Rome​ 3.44-55 44. ​[What is Appius plot t.docx
Livy, ​History of Rome​ 3.44-55 44. ​[What is Appius plot t.docxLivy, ​History of Rome​ 3.44-55 44. ​[What is Appius plot t.docx
Livy, ​History of Rome​ 3.44-55 44. ​[What is Appius plot t.docxmanningchassidy
 
Literature, Culture & SocietyLecture 4 Solitary readingDr C.docx
Literature, Culture & SocietyLecture 4 Solitary readingDr C.docxLiterature, Culture & SocietyLecture 4 Solitary readingDr C.docx
Literature, Culture & SocietyLecture 4 Solitary readingDr C.docxmanningchassidy
 
Live Your MissionDescribe how your organizations mission st.docx
Live Your MissionDescribe how your organizations mission st.docxLive Your MissionDescribe how your organizations mission st.docx
Live Your MissionDescribe how your organizations mission st.docxmanningchassidy
 
Literature ReviewYou are to write a 1200 word literature revie.docx
Literature ReviewYou are to write a 1200 word literature revie.docxLiterature ReviewYou are to write a 1200 word literature revie.docx
Literature ReviewYou are to write a 1200 word literature revie.docxmanningchassidy
 
Literature Evaluation TableStudent Name Vanessa NoaChange.docx
Literature Evaluation TableStudent Name Vanessa NoaChange.docxLiterature Evaluation TableStudent Name Vanessa NoaChange.docx
Literature Evaluation TableStudent Name Vanessa NoaChange.docxmanningchassidy
 
LITERATURE ANALYSIS TOPIC IDENTIFICATION & BIBLIOGRAPHY TEMPLATE.docx
LITERATURE ANALYSIS TOPIC IDENTIFICATION & BIBLIOGRAPHY TEMPLATE.docxLITERATURE ANALYSIS TOPIC IDENTIFICATION & BIBLIOGRAPHY TEMPLATE.docx
LITERATURE ANALYSIS TOPIC IDENTIFICATION & BIBLIOGRAPHY TEMPLATE.docxmanningchassidy
 
Literature ReviewThis paper requires the student to conduct a sc.docx
Literature ReviewThis paper requires the student to conduct a sc.docxLiterature ReviewThis paper requires the student to conduct a sc.docx
Literature ReviewThis paper requires the student to conduct a sc.docxmanningchassidy
 
literary Research paper12 paragraph paper central argument.docx
literary Research paper12 paragraph paper central argument.docxliterary Research paper12 paragraph paper central argument.docx
literary Research paper12 paragraph paper central argument.docxmanningchassidy
 
Literature Review about Infection prevention in ICU with CVC lines a.docx
Literature Review about Infection prevention in ICU with CVC lines a.docxLiterature Review about Infection prevention in ICU with CVC lines a.docx
Literature Review about Infection prevention in ICU with CVC lines a.docxmanningchassidy
 
Literature Evaluation You did a great job on your PICOT and .docx
Literature Evaluation You did a great job on your PICOT and .docxLiterature Evaluation You did a great job on your PICOT and .docx
Literature Evaluation You did a great job on your PICOT and .docxmanningchassidy
 
Literature Evaluation Table In nursing practice, accurate identi.docx
Literature Evaluation Table In nursing practice, accurate identi.docxLiterature Evaluation Table In nursing practice, accurate identi.docx
Literature Evaluation Table In nursing practice, accurate identi.docxmanningchassidy
 
Listen to the following; (1st movement of the Ravel)Ravel Pi.docx
Listen to the following; (1st movement of the Ravel)Ravel Pi.docxListen to the following; (1st movement of the Ravel)Ravel Pi.docx
Listen to the following; (1st movement of the Ravel)Ravel Pi.docxmanningchassidy
 
Listen perceptively to the Kyrie from Missa O Magnum Mysteri.docx
Listen perceptively to the Kyrie from Missa O Magnum Mysteri.docxListen perceptively to the Kyrie from Missa O Magnum Mysteri.docx
Listen perceptively to the Kyrie from Missa O Magnum Mysteri.docxmanningchassidy
 
Literary Analysis on Mending Wall” by Robert Frost The .docx
Literary Analysis on Mending Wall” by Robert Frost The .docxLiterary Analysis on Mending Wall” by Robert Frost The .docx
Literary Analysis on Mending Wall” by Robert Frost The .docxmanningchassidy
 
Literary Analysis Paper You will need to read The Red Convertibl.docx
Literary Analysis Paper You will need to read The Red Convertibl.docxLiterary Analysis Paper You will need to read The Red Convertibl.docx
Literary Analysis Paper You will need to read The Red Convertibl.docxmanningchassidy
 

More from manningchassidy (20)

Living in a Sustainable WorldImagine a future in which human bei.docx
Living in a Sustainable WorldImagine a future in which human bei.docxLiving in a Sustainable WorldImagine a future in which human bei.docx
Living in a Sustainable WorldImagine a future in which human bei.docx
 
LO Analyze Culture and SocialDiscuss the concepts in this c.docx
LO Analyze Culture and SocialDiscuss the concepts in this c.docxLO Analyze Culture and SocialDiscuss the concepts in this c.docx
LO Analyze Culture and SocialDiscuss the concepts in this c.docx
 
Literature Review Project.Assignment must comply with APA 7th ed.docx
Literature Review Project.Assignment must comply with APA 7th ed.docxLiterature Review Project.Assignment must comply with APA 7th ed.docx
Literature Review Project.Assignment must comply with APA 7th ed.docx
 
lobal Commodity Chains & Negative ExternalitiesThe worldwide n.docx
lobal Commodity Chains & Negative ExternalitiesThe worldwide n.docxlobal Commodity Chains & Negative ExternalitiesThe worldwide n.docx
lobal Commodity Chains & Negative ExternalitiesThe worldwide n.docx
 
Livy, ​History of Rome​ 3.44-55 44. ​[What is Appius plot t.docx
Livy, ​History of Rome​ 3.44-55 44. ​[What is Appius plot t.docxLivy, ​History of Rome​ 3.44-55 44. ​[What is Appius plot t.docx
Livy, ​History of Rome​ 3.44-55 44. ​[What is Appius plot t.docx
 
Liu Zhao 1 Liu Zh.docx
Liu Zhao 1                                              Liu Zh.docxLiu Zhao 1                                              Liu Zh.docx
Liu Zhao 1 Liu Zh.docx
 
Literature, Culture & SocietyLecture 4 Solitary readingDr C.docx
Literature, Culture & SocietyLecture 4 Solitary readingDr C.docxLiterature, Culture & SocietyLecture 4 Solitary readingDr C.docx
Literature, Culture & SocietyLecture 4 Solitary readingDr C.docx
 
Live Your MissionDescribe how your organizations mission st.docx
Live Your MissionDescribe how your organizations mission st.docxLive Your MissionDescribe how your organizations mission st.docx
Live Your MissionDescribe how your organizations mission st.docx
 
Literature ReviewYou are to write a 1200 word literature revie.docx
Literature ReviewYou are to write a 1200 word literature revie.docxLiterature ReviewYou are to write a 1200 word literature revie.docx
Literature ReviewYou are to write a 1200 word literature revie.docx
 
Literature Evaluation TableStudent Name Vanessa NoaChange.docx
Literature Evaluation TableStudent Name Vanessa NoaChange.docxLiterature Evaluation TableStudent Name Vanessa NoaChange.docx
Literature Evaluation TableStudent Name Vanessa NoaChange.docx
 
LITERATURE ANALYSIS TOPIC IDENTIFICATION & BIBLIOGRAPHY TEMPLATE.docx
LITERATURE ANALYSIS TOPIC IDENTIFICATION & BIBLIOGRAPHY TEMPLATE.docxLITERATURE ANALYSIS TOPIC IDENTIFICATION & BIBLIOGRAPHY TEMPLATE.docx
LITERATURE ANALYSIS TOPIC IDENTIFICATION & BIBLIOGRAPHY TEMPLATE.docx
 
Literature ReviewThis paper requires the student to conduct a sc.docx
Literature ReviewThis paper requires the student to conduct a sc.docxLiterature ReviewThis paper requires the student to conduct a sc.docx
Literature ReviewThis paper requires the student to conduct a sc.docx
 
literary Research paper12 paragraph paper central argument.docx
literary Research paper12 paragraph paper central argument.docxliterary Research paper12 paragraph paper central argument.docx
literary Research paper12 paragraph paper central argument.docx
 
Literature Review about Infection prevention in ICU with CVC lines a.docx
Literature Review about Infection prevention in ICU with CVC lines a.docxLiterature Review about Infection prevention in ICU with CVC lines a.docx
Literature Review about Infection prevention in ICU with CVC lines a.docx
 
Literature Evaluation You did a great job on your PICOT and .docx
Literature Evaluation You did a great job on your PICOT and .docxLiterature Evaluation You did a great job on your PICOT and .docx
Literature Evaluation You did a great job on your PICOT and .docx
 
Literature Evaluation Table In nursing practice, accurate identi.docx
Literature Evaluation Table In nursing practice, accurate identi.docxLiterature Evaluation Table In nursing practice, accurate identi.docx
Literature Evaluation Table In nursing practice, accurate identi.docx
 
Listen to the following; (1st movement of the Ravel)Ravel Pi.docx
Listen to the following; (1st movement of the Ravel)Ravel Pi.docxListen to the following; (1st movement of the Ravel)Ravel Pi.docx
Listen to the following; (1st movement of the Ravel)Ravel Pi.docx
 
Listen perceptively to the Kyrie from Missa O Magnum Mysteri.docx
Listen perceptively to the Kyrie from Missa O Magnum Mysteri.docxListen perceptively to the Kyrie from Missa O Magnum Mysteri.docx
Listen perceptively to the Kyrie from Missa O Magnum Mysteri.docx
 
Literary Analysis on Mending Wall” by Robert Frost The .docx
Literary Analysis on Mending Wall” by Robert Frost The .docxLiterary Analysis on Mending Wall” by Robert Frost The .docx
Literary Analysis on Mending Wall” by Robert Frost The .docx
 
Literary Analysis Paper You will need to read The Red Convertibl.docx
Literary Analysis Paper You will need to read The Red Convertibl.docxLiterary Analysis Paper You will need to read The Red Convertibl.docx
Literary Analysis Paper You will need to read The Red Convertibl.docx
 

Recently uploaded

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Recently uploaded (20)

Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 

LMP1 IO and Filesystems=========================Welcome .docx

  • 1. LMP1: I/O and Filesystems ========================= Welcome to LMP1, the first long MP. LMP1 is the first stage of a project aimed at creating a simple yet functional networked filesystem. In this MP, you will learn about and use POSIX file system calls, while subsequent LMPs will introduce memory management, messaging, and networking functionality. If you implement all parts of this MP correctly, you will be able to reuse your code for future MPs. This first LMP concentrates on the file I/O portion of the project. Specifically, you will implement a custom filesystem and test its performance using a filesystem benchmark. A benchmark is an application used to test the performance of some aspect of the system. We will be using Bonnie, a real
  • 2. filesystem benchmark, to test various performance aspects of the filesystem we implement. LMP1 consists of four steps: 1. Read the code; run the Bonnie benchmark and the LMP1 test suite. 2. Implement Test Suite 1 functionality, encompassing basic file I/O operations. 3. Implement Test Suite 2-4 functionality (directory operations, file creation/deletion, and recursive checksumming). 4. Modify Bonnie to use your client-server file I/O methods. Code structure -------------- The code for this project is structured according to the client- server model. The client code (filesystem benchmark) will interact
  • 3. with the server (filesystem) only through interface functions defined in fileio.h: int file_read(char *path, int offset, void *buffer, size_t bufbytes); int file_info(char *path, void *buffer, size_t bufbytes); int file_write(char *path, int offset, void *buffer, size_t bufbytes); int file_create(char *path,char *pattern, int repeatcount); int file_remove(char *path); int dir_create(char *path); int dir_list(char *path,void *buffer, size_t bufbytes); int file_checksum(char *path); int dir_checksum(char *path); These functions represent a simple interface to our filesystem. In Steps 2 and 3 of this MP, you will write the code for functions implementing this interface,
  • 4. replacing the stub code in fileio.c. In Step 4, you will modify a Bonnie method to use this interface, rather than calling the normal POSIX I/O functions directly. The purpose of Step 4 is to help test our implementation. Step 1: Understanding the code ------------------------------ 1. Compile the project, execute Bonnie and the test framework. Note: you may need to add execute permissions to the .sh files using the command "chmod +x *.sh". Try the following: make ./lmp1 (this runs the Bonnie benchmark - it may take a little while) ./lmp1 -test suite1
  • 5. (run Test Suite 1 - this has to work for stage1) make test (run all tests - this has to work for stage2) 2. Read through the provided .c and .h files and understand how this project is organized: bonnie.c - a version of the filesystem benchmark fileio.c - file I/O functions to be implemented fileio.h - declaration of file I/O functions restart.c - restart library (available for use in fileio.c) restart.h - declaration of restart library functions util.c - useful utility functions util.h - declaration of useful utility functions and macros In particular, pay close attention to the comments in fileio.h and bonnieb.c. You should understand what each of the following functions in bonnie.c does before undertaking the remainder of the MP: fill_file_char()
  • 6. file_read_rewrite() file_read_rewrite_block() fill_file_block() fill_read_getc() file_read_chunk() newfile() Step 2: Basic I/O operations ---------------------------- Implement file_read, file_write and file_info operations in fileio.c. If done correctly, your code should pass all suite1 tests: ./lmp1 -test suite1 Running tests... 1.read ::pass 2.info ::pass 3.write ::pass
  • 7. Test Results:3 tests,3 passed,0 failed. IMPORTANT: fileio.c is the only file you should modify for this step. Step 3: More filesystem operations ---------------------------------- Implement file and directory operations for suite2 (dir_create and dir_list), suite3 (file_create and file_remove), and suite4 (file_checksum and dir_checksum). You can test each operation and test suite individually: ./lmp1 -test dirlist ./lmp1 -test suite2 All tests should now pass: make test Running tests... 1.read ::pass
  • 8. 2.info ::pass 3.write ::pass 4.dirlist ::pass 5.dircreate ::pass 6.remove ::pass 7.create ::pass 8.filechecksum ::pass 9.dirchecksum ::pass Test Results:9 tests,9 passed,0 failed. Step 4: Performance testing --------------------------- In this step, we will change parts of Bonnie to use our filesystem interface. Make the function file_read_rewrite_block() in bonnie.c to call your
  • 9. fileio.c functions instead of POSIX I/O operations. When answering the questions below, use this modified version of bonnie.c. Before making this change, it's a good idea to write pseudocode comments for what each part of file_read_rewrite_block() does, so that you understand the code and can perform the change correctly. There may not be an exact one-to-one correspondence between our filesystem interface and the POSIX commands. Note: In future LMPs, we will be using the fileio.h interface in a similar manner, but we will call the functions remotely, via a message queue. Questions ---------
  • 10. Q1. Briefly explain what the following code from bonnie.c does: if ((words = read(fd, (char *) buf, Chunk)) == -1) ... Q2. Is the above an example of a block read or a character read? What is the value of the variable 'words' if the read succeeds? Fails? Q3. Explain the meaning of the flag value (O_CREAT | O_WRONLY | O_APPEND) for the POSIX function open(). Q4. Run Bonnie. What is being measured by each test function? Q5. Look at the summary results from the Bonnie run in Q4. Does Bonnie measure latency, throughput or something else? Justify your answer. Q6. Compare character reads with block reads using Bonnie. Which is
  • 11. faster? Why do you think this is the case? Q7. Copy and paste the performance measures output when running Bonnie benchmarks in a local directory and again in an NFS-mounted directory. Is one kind of disk access noticeably slower over the network, or are all tests significantly slower? Your home directory may be an NFS mount, whereas /tmp and /scratch are local disks. To test your code in /tmp, do the following: mkdir /tmp/your_username cp lmp1 /tmp/your_username cd /tmp/your_username ./lmp1 (record the output) cd rm -fr /tmp/your_username
  • 12. Q8. How does Bonnie handle incomplete reads, e.g., due to interruptions from signals? Justify why Bonnie's approach is good or bad for a filesystem benchmark program. Q9. By now you should be very familiar with the self-evaluation test harness we provide for the MPs. Examine the function test_file_read() in lmp1_tests.c, which tests your file_read() function from Step 2. What does this test check for, specifically? You may want to copy and paste the code for this function in your answer, and annotate each quit_if or group of related quit_ifs with a comment. LMP2: Memory Management ======================= This machine problem will focus on memory. You will
  • 13. implement your own version of malloc() and free(), using a variety of allocation strategies. You will be implementing a memory manager for a block of memory. You will implement routines for allocating and deallocating memory, and keeping track of what memory is in use. You will implement four strategies for selecting in which block to place a new requested memory black: 1) First-fit: select the first suitable block with smallest address. 2) Best-fit: select the smallest suitable block. 3) Worst-fit: select the largest suitable block. 4) Next-fit: select the first suitable block after the last block allocated (with wraparound from end to beginning). Here, "suitable" means "free, and large enough to fit the new data".
  • 14. Here are the functions you will need to implement: initmem(): Initialize memory structures. mymalloc(): Like malloc(), this allocates a new block of memory. myfree(): Like free(), this deallocates a block of memory. mem_holes(): How many free blocks are in memory? mem_allocated(): How much memory is currently allocated? mem_free(): How much memory is NOT allocated? mem_largest_free():
  • 15. How large is the largest free block? mem_small_free(): How many small unallocated blocks are currently in memory? mem_is_alloc(): Is a particular byte allocated or not? We have given you a structure to use to implement these functions. It is a doubly-linked list of blocks in memory (both allocated and free blocks). Every malloc and free can create new blocks, or combine existing blocks. You may modify this structure, or even use a different one entirely. However, do not change function prototypes or files other than mymem.c. IMPORTANT NOTE: Regardless of how you implement memory management, make sure that there are no adjacent free blocks. Any such blocks should be merged into one large block.
  • 16. We have also given you a few functions to help you monitor what happens when you call your functions. Most important is the try_mymem() function. If you run your code with "mem -try ", it will call this function, which you can use to demonstrate the effects of your memory operations. These functions have no effect on test code, so use them to your advantage. Running your code: After running "make", run 1) "mem" to see the available tests and strategies. 2) "mem -test " to test your code with our tests. 3) "mem -try " to run your code with your own tests (the try_mymem function). You can also use "make test" and "make stage1-test" for testing. "make stage1-test" only runs the tests relevant to stage 1.
  • 17. As in previous MPs, running "mem -test -f0 ..." will allow tests to run even after previous tests have failed. Similarly, using "all" for a test or strategy name runs all of the tests or strategies. Note that if "all" is selected as the strategy, the 4 tests are shown as one. One of the tests, "stress", runs an assortment of randomized tests on each strategy. The results of the tests are placed in "tests.out" . You may want to view this file to see the relative performance of each strategy. Stage 1 ------- Implement all the above functions, for the first-fit strategy. Use "mem -test all first" to test your implementation. Stage 2
  • 18. ------- A) Implement the other three strategies: worst-fit, best-fit, and next-fit. The strategy is passed to initmem(), and stored in the global variable "myStrategy". Some of your functions will need to check this variable to implement the correct strategy. You can test your code with "mem -test all worst", etc., or test all 4 together with "mem -test all all". The latter command does not test the strategies separately; your code passes the test only if all four strategies pass. Questions ========= 1) Why is it so important that adjacent free blocks not be left as such? What would happen if they were permitted?
  • 19. 2) Which function(s) need to be concerned about adjacent free blocks? 3) Name one advantage of each strategy. 4) Run the stress test on all strategies, and look at the results (tests.out). What is the significance of "Average largest free block"? Which strategy generally has the best performance in this metric? Why do you think this is? 5) In the stress test results (see Question 4), what is the significance of "Average number of small blocks"? Which strategy generally has the best performance in this metric? Why do you think this is? 6) Eventually, the many mallocs and frees produces many small blocks scattered across the memory pool. There may be enough space to allocate a new block, but not in one place. It is possible to compact the memory, so all the free blocks
  • 20. are moved to one large free block. How would you implement this in the system you have built? 7) If you did implement memory compaction, what changes would you need to make in how such a system is invoked (i.e. from a user's perspective)? 8) How would you use the system you have built to implement realloc? (Brief explanation; no code) 9) Which function(s) need to know which strategy is being used? Briefly explain why this/these and not others. 10) Give one advantage of implementing memory management using a linked list over a bit array, where every bit tells whether its corresponding byte is allocated.