command.com
? List some of the differences
between these commands and their Unix equivalents.
char *tmpnam(char *s);which returns the name of a unique file. This file can be opened for reading or writing with guarantee that no other process shoud be using this.
DWORD GetTempPath(DWORD bufferSize, LPTSTR buffer); UINT GetTempFileName(LPCTSTR path, LPCTSTR prefix, UNIT unique, LPTSTR tempFile);to get a temporary path name. The path from the first call becomes the path for the second. The prefix is upto three chars that start the temporary file name. unique can be zero or non-zero. The temporary name is placed in tempFile. The function returns zero on error. Write a program that generates a unique name, and prints it.
DWORD GetLogicalDrives()returns a 32-bit value with each bit set if the drive is available: bit 1 is one if A is available, bit 2 is one if B is available, etc.
#include <unistd.h> int access(const char *pathname, int mode);This takes the path of a file and a bit-mask for the mode of R_OK, W_OK, X_OK and F_OK for read, write, execute, or file existence.
#include <time.h> clock_t clock(void);The value returned is the CPU time used so far as a clock_t; to get the number of seconds used, divide by CLOCKS_PER_SEC.
obtain 6 blocks obtain 10 blocks obtain 16 blocks obtain 8 blocksShow the state of memory after each request.
Virtual Page page index ------------------ 0 2 1 2 3 3 4 5 5 6 7 0 8 4 9 1
system()
by used to create
asynchronous processes under Unix? (Hint: how can the user create
asynchronous processes at the command prompt?)
How many processes are created by doing this?
What is
happening to each, in terms of fork()
and
exec()
?
ps -l
?
What is the command ps -f
showing?
gdb
debugger will track the parent process
when a fork()
is executed. A separate debugger
can be started on a program by gdb program pid
.
Write a simple multi-process program and track each process using
gdb
.
xclock
, xterm
, and other programs in
/usr/bin/X11
SIGCHLD
which will report when a child process terminates. See the man page
for signal
.
ps | sed 1d | wc -lRewrite this as a program in C