preparing to the exam. agenda exam material (for the 100 time) frequantly asked questions stupid...

61
Preparing to the exam

Post on 19-Dec-2015

244 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Preparing to the exam

Page 2: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Agenda

EXAM MATERIAL (FOR THE 100 TIME)

FREQUANTLY ASKED QUESTIONS

STUPID QUESTIONS

PERSONAL QUESTIONS

EXAM EXAMPLE

MORE EXAMPLE QUESTIONS

YOUR QUESTIONS

I SPLIT AT 1:50 SHARP. FEEL FREE TO WASTE EVERYBODY’S TIME WITH SILLY QUESTIONS

Page 3: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

EXAM MATERIAL

USERLAND INTRODUCTION TO OS and Linux

Simple command line tools you should know What is system call, what is library function

SOCKETS INET, UNIX, STREAM DGRAM Socket(2), bind(2), listen(2), accept(2), connect(2), send(2) recv(2),

sendto(2), recvfrom(2) IO Multiplexing (select) Process

Creation, environment, termination Fork(2), execXX(2/3), wait(2), signal(2), sigaction(2), getpid(2),

getppid(2) syslog

Page 4: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

EXAM MATERIAL

USERLAND Software development under unix

GCC, make, debugging tools Horrors presentations

File and directory I/O Open/close API Read, write API Mmap API Directories and dirent

Posix threads API Posix threads Posix mutex Posix conds Threads vs. process Basic syncing

Page 5: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

EXAM MATERIAL

Theory Virtual memory Syncing GRID UFS Kernel,kernel module at presentation level

Kernel programming I assume you:

Red the presentation Took one glace at the files I referred to Wrote hello world kernel module and module that register

filesystem I don’t assume you finished ex 3.

Page 6: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

NOT EXAM MATERTIAL

Last lecture about NSPR

WINDOWS

BITS AND BYTES IN THE KERNEL (what does the 3rd argument to this function do… it is on userland though)

Specific EXT2/MINIX code (I can ask about UFS or code that was shown on the lecture or similar code taken from those file system but not on specific optimization code taken from one of them)

Page 7: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

FAQ

Q 43.765 from homework Not all questions we asked had boolean solution sometimes the

question was open and sometimes we just wanted an intelligent answer for example when I asked is dirent contain a null terminated string or length (both are true) I just wanted to see if somebody reply. Similarly when we asked why did you select execXX() and not other exec funtion or what is faster TCP or UDP. We just wanted to see if the student actually done the homework.

Q 231.33 from the test is not clear We gave the final test to 4 people to review (we didn’t do the same

with the example) so We believe that there are no more unclear answers… still if we see significant percentage choosing the wrong answer, and this choice has some sense we may accept both

Page 8: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

STUPID QUESTIONS

Stupid questions What happens when two process try to lock the same file What happens when we call mmap(2) change memory content

and kill the process What happens when process with three threads has one thread

calls exit

In a valiant effort to make programmers out of the students the Tutoring assistant will not answer any questions you can figure out the answer by writing 20 line example program in 10 minutes

It is hard! But I am determined to be successful not answering stupid questions no matter how trivial and easy they are! RTFM, Write a simple test program & STFU.

Page 9: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Personal question

Several students have requested I’ll give elective course/workshop in 2nd term.

Assuming the topic for such course will be one of the following 3, and assuming day will work out for you how many students will join course or workshop (raise hands)

Topics Advanced course in networking/storage networking (scsi, SAN

protocols, Multicast IP, Fibre channel etc.) Games programming (programming game scripts for point and

click engines, games AI scripts, Cg etc.) Advanced course on UNIX OS (kernel, scripts, user management

things we never got to cover)

Page 10: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Exam for example

We will now solve the exam for example

We will try the following method

Boys Vs. Girls 1 point for each correct answer

Page 11: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 1

Int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg);

The 4th argument to pthread_create Will include the return value of the thread Will include the heap of the created thread Will include the heap of the created thread if

not NULL None of the above

Page 12: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 2

Datagram sockets Are only usable in UNIX domain sockets Should not be used for internet streaming

protocols (such as RTP) Send packets that are never broken or spliced Cannot be used on Microsoft Windows

Page 13: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 3

Socket is used to Create communication end point Connect to a server Bind a port Only by programs that work with the internet

Page 14: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 4

Open(2) can be used To create a new file To open existing file To open a device All of the above

Page 15: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 5

mmap(2) should never be used In threaded application In multi process application With socket as file descriptor None of the above

Page 16: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 6 + 7

Following are functions pairs. Please specify if they are blocking (answers – a = both , b = 1st , c = 2nd d = none) (assume default flags)

Select(2), signal/sigaction(2) b

recv(2),scanf(3) a

Page 17: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 8+9

which of the following can we wait using select (a = both b=1st c = 2nd d= none)

stream socket and dgram socket a

POSIX Cond and large matrix multiplication d

Page 18: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 10

TCP server (AF_INET, SOCK_STREAM) calls functions in the following order Socket(2), connect(2), accept(2),recv(2) Open(2), bind(2), connect(2), send(2) Socket(2), bind(2), listen(2), accept(2) Open(2), bind(2), connect(2), recv(2)

Page 19: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 11

UNIX domain sockets are Faster the AF_INET socket Only work on the same host One of the many forms of IPC (Inter process

communication) All of the above

Page 20: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 12

What is wrong in the following codeWhile (time(NULL) >time_to_start)

The following code will take 100% cpu while waiting (busy waiting)

The time(2) function is deprecated The time(2) function is not thread safe There is nothing wrong with that code

Page 21: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 13

When in main we call pthread_create twice and no thread has finised. How many threads are in the process? 1 2 3 4

Page 22: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 14

Two scenarios

Scenario A process open(2) a file. Call fork(), parent calls exit(2).Child still has some work to do.

Scenario B process open(2) a file. Call pthread_create(3), first thread finishes it’s work. Calls exit(2), 2nd thread still has work to do. BOTH scenario’s are OK ONLY A scenario is OK ONLY B scenario is OK BOTH should FAIL

Page 23: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 15

We expect to find system call man pages in man 1 man 2 man 3 man 4

Page 24: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 16

We expect to find syslog output under linux (in tau labs) at /messages /var/log/messages /usr/log/messages ~root/log/messages

Page 25: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 17

GDB outputProgram terminated with signal 11, Segmentation fault.#0 0x0000000000400492 in crash_here () at crash.c:44 *c=12; The programmer accessed a memory she has not

allocated The programmer had an endless loop/damned

recursion The programmer had called a system call/function with

bad parameters The programmer divided by 0

Page 26: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 18

Process 24501 attached - interrupt to quitselect(50, [], NULL, NULL, {0, 0}) = 0 (Timeout)select(50, [], NULL, NULL, {0, 0}) = 0 (Timeout)select(50, [], NULL, NULL, {0, 0}) = 0 (Timeout)select(50, [], NULL, NULL, {0, 0}) = 0 (Timeout)select(50, [], NULL, NULL, {0, 0}) = 0 (Timeout)

What’s wrong? The programmer forgot select ruins it’s arguments There is nothing wrong with the program Select(2) FD_SET is broken Select is deprecated use pselect(2)

Page 27: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 19

In GCC –o is the compile switch –o is the output switch –o is the optimize switch none of the above

Page 28: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 20

In UNIX Each process has environment (char ** environ) Each process has Parent process ID Each process has current working directory All the above

Page 29: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 21

Syslogd Is a process Only root can write to syslog Onlu the kernel can write to syslog None of the above

Page 30: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 22

pid_t fork(void);

fork(2) Should never be used with the standard library If we have buffers that are not flushed they may

be duplicated Should never be used if we also use threads A+B

Page 31: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 23

Producer-Consumer Is a situation where one task consume all the memory

and does nothing useful (while the producer actually does something that is required

Is a situation where one task consume some resource (memory/IO/CPU) damaging more important producer tasks

Is a situation where tasks that produce more output also consume more resources

Is a situation where we have two tasks one producing work packet and the other handling (=consume) them

Page 32: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 24

We can use socket messages To deliver information between process To make a cond like mechanism between process

(only after receiving the messages you can work) When we want to do I/O multiplexing and use select All the above

Page 33: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 25

Deadlock can occur Between threads Between sockets Between environment variable Between terminals

Page 34: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 26

Comparing mmap(2) and read(2)/write(2) Apis

Read/write should be used When we want to maximuze performance When we have read(2)/write(2) permissions When we want to maximize portability B+C

Page 35: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 27

// lines from C program

// … if ((src = mmap (0, statbuf.st_size, PROT_READ,

MAP_SHARED, fdin, 0)) == (caddr_t) -1) // error handling removedif ((dst = mmap (0, statbuf.st_size, PROT_READ |

PROT_WRITE, MAP_SHARED, fdout, 0)) == (caddr_t) -1)// error handling removedmemcpy (dst, src, statbuf.st_size); } /* main */

Page 36: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 27

The files will not be copied because we didn’t call msync(2)

The files will not be copied because we didn’t call munmap(2)

The files will be copied because after we fell from main (assuming the computer was still on)

A+B

Page 37: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

IMPORTANT NOTE REGARDING Q 27

Falling from main does not call munmap

Mmap marks buffer as dirty (as we learned in kernel)

After a while the kernel will put the dirty buffers to disk

If we call munmap we can force write. If we write again we can save writes

But under no circumstances exit checks for memory buffers and calls munmap

Page 38: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 28

Kernel modules Have to be GPL Allow the user to add functionality to the Linux

kernel Can only be programmed by the kernel vendors Are only used to support additional hardware

devices

Page 39: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 29

File system fragmentation Is a condition where files are not placed in

contingent blocks on the disk Is a condition where a file was not unmounted

properly (for example after system unclean shutdown)

Is a condition when a file system is out of inodes but still has blocks

Is a condition when all users are out of quota but there are still free blocks

Page 40: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 30

Check the following code from ext2 kernel 

staticstructinode *ext2_alloc_inode(structsuper_block *sb) {

struct ext2_inode_info *ei;

ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, GFP_KERNEL);

if (!ei) return NULL;

ei->i_block_alloc_info = NULL;

ei->vfs_inode.i_version = 1;

return&ei->vfs_inode;

}

Page 41: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 30

The code returns struct inode *. In order to get the inode info one must use pointer arithmatics

The code return struct ext2_inode_info

The code return structinode *. There is no way to get the allocated pointer

The code return structinode *. The allocated struct is pointed by structinode->i_private.

Page 42: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 31

The following code (copy/paste from kernel sources)

module_init(init_ext2_fs)

module_exit(exit_ext2_fs) Doesn’t compile Compile only in the kernel (because kernel have

different rules) Defines the function that will be called on module

init and termination Requires ; in the end of each line to compile

Page 43: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 32

The reason function pointers to function implementation are used in struct inode is To improve performance To support more operations So that different file system can be implemented All of the above

Page 44: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 33 + 34

Virtual memory Works in Linux Works in UNIX Works in Windows All of the above 

Virtual memory Reside in memory until we call rmmod Is a different kind of memory Allows running programs that require more memory then we

currently have Slows the PC down (due to page faults) and therefore is not used

in modern OS

Page 45: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 35

Which of the below is not a scheduling criterion Max CPU utilization Max throughput Is used world wide Min response time None of the above

Page 46: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Question 36

JDL allows you to code grid jobs (just like C/C++ on the host) to mix C code and Java code on Grid environment to submit grid jobs to split matrix computation over GRID resources

Page 47: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

TIE BREAKING QUESTIONS

USER SPACE

BLOCKING FUNCTIONS

SELECT INPUTS and FD

FILE SYSTEM

KERNEL

HORRORS

Page 48: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Pthread

The simplest way to transfer multiple arguments to thread is Put args in a file. Transfer filename Put args in hash table. Transfer key to each thread Put args in struct. Transfer struct * There is no simple way

Page 49: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

What functions blocks out of the following functions

Toupper(3)

Lseek(2)

munmap(2)

Log(3) (linking with –lm)

Getch(3)

Page 50: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

What can be used as input to select

UDS-Stream

Mmap file

Standard error (stderr)

FILE *

Page 51: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

More horrors

Whats wrong with the following code300 if ((pid = fork()) == 0) {301 if (execl("/bin/bzip2", "bzip2",

SERVER_UNCOMP_FILE , 0, NUL L) == -1) {}305 }306 file_zipped = 1;=== // inside main542 if (pthread_cond_signal(&zip_cond) != 0) {}548 if (pthread_mutex_unlock(&zip_mutex) != 0) {}566 sleep(1); 601 if (pthread_mutex_lock(&send_mutex) != 0) {}

Page 52: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Kernel question

How do we add specific file system data to struct super_block

Using void * s_fs_info We read it from disk all the time We write it in the boot sector and hold it in struct

s_fs_info we give to register_filesystem we save it on the first dummy inode

Page 53: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Virtual memory

Virtual memory algorithms (LRU, 2nd fault etc.) Minimize page faults Minimize their own processing time Minimize process wait time on ready queue Minimize virtual memory usage

Page 54: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Two scenarios

Scenario A – process calloc(3) memory on the heap. Calls fork(2) father and child process use fcntl(2) for locking and communicate via the calloced memory as shared memory

Scenario B – process callc memory on the heap. Calls pthread_create(3) both threads use fcntl(2) for locking and communicate via the calloced memory as shared memory

Page 55: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

UNIX

In UNIX zombie is A type of daemon that does no I/O The saved returned value of a child process that was

not yet wait(2)ed for by father A process that is doing busy waiting for a long time MS windows

Page 56: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Process and threads

Which statement is not true Threads are simpler to create then processes We can only use Producer consumer in threads using

posix cond Threads share the entire memory. Further more they

also share the process environment (FD etc.) POSIX threads require compiling with –lpthread

Page 57: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Communication

In UDS-Stream We implement all TCP algorithms and gain

performance because we limit them to local host We will always work slower then internet datagram

sockets (UDP) We can send information to remote host if we use

nfs mounted files as path We can use mmap(2) to speed up receiving time

Page 58: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

File system

When implementing mmap for UFS file system We usually call linux page function and give the a

get_block function pointer We use address_space_operation structure We assign functions pointer struct on each class

inode All of the above

Page 59: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

GRID

GRID book-keeping Is used to decide how much to charge user for

resource consumption Is one of the methods used for GRID user

management Is only done for I/O of over 150MB Is done by each computer to monitor how much of

it's resources the GRID consumes

Page 60: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Socket

Socket(2) function Is non blocking for UDS Is required for all forms of IPC Requires –lsocket compile flag A+B

Page 61: Preparing to the exam. Agenda  EXAM MATERIAL (FOR THE 100 TIME)  FREQUANTLY ASKED QUESTIONS  STUPID QUESTIONS  PERSONAL QUESTIONS  EXAM EXAMPLE

Wish me luck on the bridge festival