From 8c12928cc59b5a0b1d9aa6aada2772d0d2320542 Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Thu, 25 Jul 2019 06:50:12 -0400 Subject: First draft of first lab assignment? --- labs/xv6.html | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'labs/xv6.html') diff --git a/labs/xv6.html b/labs/xv6.html index fcbb234..2f6a4ae 100644 --- a/labs/xv6.html +++ b/labs/xv6.html @@ -178,6 +178,44 @@ initial file system. You just ran one of them: ls.
  • Don't recurse into "." and "..". +

    Optional: support regular expressions in name matching. Grep has some + primitive support for regular expressions. + +

    xargs

    + +

    Write a simple version of the UNIX xargs program: read lines from + standard in and run a command for each line, supplying the line as + arguments to the command. The following example illustrates xarg's + behavior: +

    +    $ xargs echo bye
    +    hello too
    +    bye hello too
    +    
    +    $
    +  
    + Note that the command here is "echo bye" and the additional + arguments are "hello too", making the command "echo bye hello too", + which outputs "bye hello too". + +

    xargs and find combine well: +

    +    find . b | xargs grep hello
    +  
    + will run "grep hello" on each file named b in the directories below ".". + +

    Some hints: +

    + +

    Optional: modify the shell

    Modify the shell to support wait. -- cgit v1.2.3 From c0b1c239ea97bb56ad5c24110e6d52e9633a2847 Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Thu, 25 Jul 2019 07:07:03 -0400 Subject: x --- labs/xv6.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'labs/xv6.html') diff --git a/labs/xv6.html b/labs/xv6.html index 2f6a4ae..de18ac7 100644 --- a/labs/xv6.html +++ b/labs/xv6.html @@ -109,7 +109,7 @@ initial file system. You just ran one of them: ls. $ make qemu ... init: starting sh - $ sleep 5 + $ sleep 10 (waits for a little while) $ -- cgit v1.2.3 From 808811f9f49a21ae1a00b2e5805cf62cc31c0518 Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Thu, 25 Jul 2019 07:47:22 -0400 Subject: Add syscall tracing to the first xv6 lab --- labs/xv6.html | 51 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 5 deletions(-) (limited to 'labs/xv6.html') diff --git a/labs/xv6.html b/labs/xv6.html index de18ac7..7699b06 100644 --- a/labs/xv6.html +++ b/labs/xv6.html @@ -215,17 +215,58 @@ initial file system. You just ran one of them: ls. to declare an argv. +

    System call tracing

    -

    Optional: modify the shell

    +

    In this exercise you will modify the xv6 kernel to print out a line +for each system call invocation. It is enough to print the name of the +system call and the return value; you don't need to print the system +call arguments. + +

    +When you're done, you should see output like this when booting +xv6: + +

    +...
    +fork -> 2
    +exec -> 0
    +open -> 3
    +close -> 0
    +$write -> 1
    + write -> 1
    +
    + +

    +That's init forking and execing sh, sh making sure only two file descriptors are +open, and sh writing the $ prompt. (Note: the output of the shell and the +system call trace are intermixed, because the shell uses the write syscall to +print its output.) -

    Modify the shell to support wait. +

    Hint: modify the syscall() function in kernel/syscall.c. + +

    Run the programs you wrote in the previous exercises and inspect + the system call trace. Are there many system calls? Which systems + calls correspond to code in the applications you wrote above? + +

    Optional: print the system call arguments. -

    Modify the shell to support lists of commands, separated by ";" +

    Optional: modify the shell

    -

    Modify the shell to support sub-shells by implementing "(" and ")" +There are endless ways in which the shell could be extended. Here are +some suggestions: -

    Modify the shell to allow users to edit the command line +

    + -- cgit v1.2.3 From 57a861bea1ef57a44574cfc74737d5b35db0e261 Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Thu, 25 Jul 2019 08:19:14 -0400 Subject: Checkpoint start syscall lab --- labs/xv6.html | 35 ----------------------------------- 1 file changed, 35 deletions(-) (limited to 'labs/xv6.html') diff --git a/labs/xv6.html b/labs/xv6.html index 7699b06..8dc7786 100644 --- a/labs/xv6.html +++ b/labs/xv6.html @@ -215,41 +215,6 @@ initial file system. You just ran one of them: ls. to declare an argv. -

    System call tracing

    - -

    In this exercise you will modify the xv6 kernel to print out a line -for each system call invocation. It is enough to print the name of the -system call and the return value; you don't need to print the system -call arguments. - -

    -When you're done, you should see output like this when booting -xv6: - -

    -...
    -fork -> 2
    -exec -> 0
    -open -> 3
    -close -> 0
    -$write -> 1
    - write -> 1
    -
    - -

    -That's init forking and execing sh, sh making sure only two file descriptors are -open, and sh writing the $ prompt. (Note: the output of the shell and the -system call trace are intermixed, because the shell uses the write syscall to -print its output.) - -

    Hint: modify the syscall() function in kernel/syscall.c. - -

    Run the programs you wrote in the previous exercises and inspect - the system call trace. Are there many system calls? Which systems - calls correspond to code in the applications you wrote above? - -

    Optional: print the system call arguments. -

    Optional: modify the shell

    There are endless ways in which the shell could be extended. Here are -- cgit v1.2.3