Tuesday, May 5, 2009
Thursday, March 12, 2009
Engineering exer 3 - FAQ
Q: If either of the default files doesn't exists, what should be done?
A: The exercise clearly states: "In case either of the defult files doesn’t exist - exit(-1);", hence if either default-file or the fail-file doen't exist the entire program (i.e. also the parent process) should exit as niether child can carry out his job (by exercise defintion).
-----------------------------------------------------------------------------------------------------------------------------------
Q: If any system call fails what should be done?
A: The process who encountered the failed system call should exit(-1).
-----------------------------------------------------------------------------------------------------------------------------------
Q: Can I assume that the parameters given to the program have a correct syntax, e.g. a port number is a non-negative integer smaller than 65,535?
A: Yes.
-----------------------------------------------------------------------------------------------------------------------------------
Q: The web browser doesn't display the file I sent him until I kill the process, how can I change this?
A: There are a few ways of doing this, one of them is to close() the socket.
-----------------------------------------------------------------------------------------------------------------------------------
Q: Can I assume that the requested file is in the same directory as the processes' current working directory?
A: It can either be in the same directory or relative to it. E.g. a sub-directory inside the current working directory.
A: The exercise clearly states: "In case either of the defult files doesn’t exist - exit(-1);", hence if either default-file or the fail-file doen't exist the entire program (i.e. also the parent process) should exit as niether child can carry out his job (by exercise defintion).
-----------------------------------------------------------------------------------------------------------------------------------
Q: If any system call fails what should be done?
A: The process who encountered the failed system call should exit(-1).
-----------------------------------------------------------------------------------------------------------------------------------
Q: Can I assume that the parameters given to the program have a correct syntax, e.g. a port number is a non-negative integer smaller than 65,535?
A: Yes.
-----------------------------------------------------------------------------------------------------------------------------------
Q: The web browser doesn't display the file I sent him until I kill the process, how can I change this?
A: There are a few ways of doing this, one of them is to close() the socket.
-----------------------------------------------------------------------------------------------------------------------------------
Q: Can I assume that the requested file is in the same directory as the processes' current working directory?
A: It can either be in the same directory or relative to it. E.g. a sub-directory inside the current working directory.
Monday, March 2, 2009
Exercise 3 for computational biology
Please read the lstat() man page throughly, including the SEE ALSO section. It contains most of the answers to the questions you have.
Usfull functions:
lstat()/stat()
opendir()
readdir()
closedir()
readlink()
major()/minor()
Usfull functions:
lstat()/stat()
opendir()
readdir()
closedir()
readlink()
major()/minor()
Thursday, January 22, 2009
Monday, January 19, 2009
Tuesday, January 13, 2009
Exercise #2 Clarifications and FAQ
Clrifications
int *shm;
...
... = shmget(..., SIZE, ...);
shm = shmat(...);
...
... = write(STDOUT_FILENO, shm, SIZE);
Q: I can't allocate large shared memory segments (more than 26^4*4 needed for the exercise), how can I make larger allocations?
A: The reason for this is a limit in the kernel by a variable named 'shmmax'. To change the value of shmmax you should execute the following command as root:
# sysctl -w kernel.shmmax=
For the exercise should be set to 1285089624, which is the sum of:
(26^1+26^2+26^3+26^4+26^5+26^6)*4, or in other words:
# sysctl -w kernel.shmmax=1285089624
- Output printing: the shared memory segment should be written to the standard output as a binary string. For e.g.:
int *shm;
...
... = shmget(..., SIZE, ...);
shm = shmat(...);
...
... = write(STDOUT_FILENO, shm, SIZE);
- Number of semaphores to use: The number of semaphores to use is up to you, but must allow the parallel execution and not serialize it. A single semaphore is not enough and 26^6 is too much. As engineering students you can surely come up with a reasonable number which allows good enough performance. Several possible strategies were discussed in the classroom and you are welcome to define a new one that will work well enough.
- Characters to count: you should only count lower-case english charachters, i.e. characters 'a'-'z' which are ASCII characters 97-122. All other characters should be ignored, i.e. (extended) ASCII characters 0..96 and 123..255 (e.g. 'A'..'Z', ' ','0'..'9', etc). Each non countable character breaks a sequence, i.e. if any other character than 'a'..'z' appears in a string it will be considered as two different strings. e.g. 'abc abcdeFg', has no countable 6 letters sequence in it and has only a single five characters sequence in it (i.e. 'abcde'), a two 4 charachter sequences ('abcd', 'bcde') etc.
Q: I can't allocate large shared memory segments (more than 26^4*4 needed for the exercise), how can I make larger allocations?
A: The reason for this is a limit in the kernel by a variable named 'shmmax'. To change the value of shmmax you should execute the following command as root:
# sysctl -w kernel.shmmax=
For the exercise
(26^1+26^2+26^3+26^4+26^5+26^6)*4, or in other words:
# sysctl -w kernel.shmmax=1285089624
Subscribe to:
Posts (Atom)