







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








(a) (2pts) How many addresses are needed to address a 64 kilobyte (2^16 ) file?
(b) (4pts) How large of a file can be addressed by the double indirect block alone?
(c) (4pts) Does a 4 megabyte (2^22 ) file use all of the addresses on its I-node? Any addresses in the single indirect block? double indirect? triple indirect?
(d) (5pts) How much disk space (including overhead) is used to store the addresses required to access a 4 megabyte file (the answer involves more than one calculation)?
#define BLKSIZE 4096 // int copyfile(int fromfd, int tofd) // Attempts to copy all readable bytes from file descriptor fromfd to file // descriptor tofd. // File descriptors are assumed opened before the call to copyfile(), and // shall not be closed by the function. // if successful returns the number of bytes copied from fromfd to tofd // in the event of an error other than EINTR (automatic restart on EINTR), // errno is set and -1 is returned int copyfile(int fromfd, int tofd) {
We seek to have a server with a lot of fast memory (4 gigabytes), that is running a simple memoryServer program. Clients should be able to connect to it over a very fast network connection, and then request memory that they can use to store and load data. The clients have only 64kb of local memory to use, and no disk from which to swap virtual memory. The client will have an instantiation of a memoryClient class which can be used to allocate more memory as needed, or transfer data to and from the server.
Give all the details you can (network protocols, how and when to connect, if the applications are multithreaded, virtual memory sizes, how much memory to swap across the network for a “mapoffset()” call, etc) of how the algorithm should be structured to allow the server to service numerous connecting clients. Be explicit and verbose in your response.
Also be sure to address these 2 questions:
Manual page
ssize_t read(int fd, void *buf, size_t count); read() attempts to read up to count bytes from file descriptor fd into the buffer starting at buf. If count is zero, read() returns zero and has no other results. On success, the number of bytes read is returned (zero indicates end of file). It is not an error if this number is smaller than the number of bytes requested. On error, -1 is returned, and errno is set appropriately.
ssize_t write(int fd, const void *buf, size_t count); write() writes up to count bytes to the file referenced by the file descriptor fd from the buffer starting at buf. On success, the number of bytes written are returned (zero indicates nothing was written). On error, -1 is returned, and errno is set appropriately.