## multiexec

#### OS/161 Reference Manual

### Name

multiexec - run many exec calls at once

### Synopsis

`/testbin/multiexec` [-j nprocs] [prog [arg ...]]

### Description

`multiexec` forks several subprocesses and then uses user-level semaphores to cause them to all enter execv at as close as possible to the same time. This is useful for seeing what happens if having too many argv buffers in use at once causes the kernel to run into problems, or to test the efficacy of measures to mitigate those problems.

The default number of subprocesses is 12. The default program each subprocess runs is pwd. Other larger programs can be run by giving the program name and arguments on `multiexec`'s command line.

### Requirements

`multiexec` uses the following system calls:

- getpid
- open
- read
- write
- close
- remove
- fork
- execv
- waitpid
- _exit

`multiexec` should work once you have implemented the basic system calls. Exactly what the requirements are for handling large multiexec invocations is up to your course staff, although probably at a minimum your kernel shouldn't crash.

Until you implement remove, which is typically not part of the basic system calls assignment, `multiexec` will not be able to clean up after itself. This is untidy but not a problem.

### Bugs

`multiexec` has a compiled-in limit of 64 words in the argv array to be passed to its subprocesses. Also, there should be an easy way to pass a very large argv. In the meantime, perhaps try having `multiexec` run bigexec.

### Restrictions

Be aware that until you do the VM assignment and replace dumbvm, running a lot of execs will run the system out of memory very rapidly.