Archive for the 'Labs' Category

Lecture evaluation results

The results of the course evaluation are available (PDF):

and will be discussed during the last lecture.

Sample solution to the proxy lab

On the lab page you can find a sample solution to the filesystem lab.

 

OpenMP parallel lab is online

The last (optional) lab is finally online. You can get all the details at the parallel lab webpage.

As usual, if there are any questions, comments or bugs, file them to Mathias.

So long, and have fun with the last optimization lab.

Possible problem with parse_uri if the URL is malformed

If the URL that is passed to parse_uri just contains a hostname withouy any path (e.g. http://www.foo.bar) then the function might cause a core dump because there is a small bug in the parse_uri function…

The diff for the parse_uri function looks as follows:

/* Extract the host name */
hostbegin = uri + 7;
- hostend = strpbrk(hostbegin, ” :/\r\n\0″);
+ /* does not work because it maps to the end-of-string and strpbrk
+ * will return NULL
+ */
+ //hostend = strpbrk(hostbegin, ” :/\r\n\0″);
+ hostend = strpbrk(hostbegin, ” :/\r\n”);
+ if (hostend == NULL) hostend = hostbegin+strlen(hostbegin);
len = hostend – hostbegin;
strncpy(hostname, hostbegin, len);
hostname[len] = ‘\0′;

Of course you can download the corrected handout at http://www.lst.inf.ethz.ch/teaching/lectures/ss07/2100/proxy_lab/proxylab-handout.tar

Programming language of choice for proxy-lab

As Matteo said in the lecture you can choose your programming language for this lab. But keep in mind that the exercise should not be made simpler than it is in C. So you should not use any high-level functions to program sockets and use high-level objects for String manipulation or URL-handling.

Also dont use any uncommon or unusual languages. If you are in doubt, check back with Mathias.

Deadline extension for proxy lab & information for HTTP/1.1

Some of you told me that you don’t have enough time to complete the proxy lab, so the deadline is postponed to June, 10.

Also you have to take care for some special hickups if you use HTTP/1.1 because the connection is not closed when all data is transfered.

You can use the following procedure to avaid a (forever) blocking read:

  • Read the header line based and parse the content-length field (if present)
  • If the content-length is present, then read the given bytes and pass them to the client
  • Otherwise continue reading until you read

Also keep in mind that you might need to reformat “GET http://server/path/ HTTP/1.1″ to “GET path/ HTTP/1.1\nHost: server” depending on the server implementation of HTTP/1.1.

Last lab: optional

The last lab about parallelization with OpenMP will be optional and will provide the possibility to raise the grade of a student or a group (but not to lower it).

I will present the details during monday’s lecture.

New exercise sheet for the proxy_lab available

I was told that there was a mistake in the proxy_lab and filesystem_lab exercise sheets. They stated that groups up to three people could be formed, but the course homepage itself says that only groups up to two people are allowed.

So I wanted to clarify that only groups up to TWO people are allowed to work together.

I hope that this does not cause any inconveniences to you. If there are any problems, step by at my office and we’ll try to solve them!

Doxygen documentation

An example of Doxygen documentation for the filesystem lab is available in HTML and PDF format. The settings used to generate the documentation can be found in the Doxygen configuration file.

Sample solution to the filesystem lab

On the lab page you can find a sample solution to the filesystem lab.

Proxy Lab

The new assignment is out, check the website at http://www.lst.inf.ethz.ch/teaching/lectures/ss07/2100/proxy_lab/index.html

Tests for the append operation

A new version of the handout is available online. It contains a new fstest.c with some bug fixes

Addition to the evaluation image tests

A new command file is available to test for the append operation (if a write is issued on an existing file the written content will be appended at the end of the existing data).

Wrong arguments

You can assume that the parameters passed to the filesystem lab are correct. You are not requested to check for invalid file names (with non-legal characters) or invalid paths (e.g. fs_creat("/non-existing-dir/file-to-be-created.ext"))

Filesystem Lab: simplifications

Your FAT driver can have the following limitations:

  • you can limit yourself to FAT12 images
  • your driver should be able to create new files but not necessarily new directories
  • you can ignore long file names
  • required operations:
    • open and close a file
    • open a file, read the content, close it
    • open a file in a subdirectory, read the content, close it
    • create a file, write Hello world! and close it
    • create a file in a subdirectory, write Hello world! and close it
    • work with more than one open file at the same time
    • create a file with more than 2K of content and close it
    • append content to an existing file

You can test the listed operations with evaluation.img image file and the corresponding evaluation.img.command command file

Deadline extension

Die deadline for the filesystem lab is extended to 2007-05-20 (next Sunday).

Sample solution to the scheduler lab

On the lab page you can find a sample solution to the scheduler lab.

Checking a disk image

To test changes on a disk image (performed with the fs_creat and fs_write calls) you should check the modified image file with a filesystem checker.

Example on Linux:

$ fsck.vfat -lnv single.img
dosfsck 2.11 (12 Mar 2005)
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "mkdosfs"
Media byte 0xf8 (hard disk)
       512 bytes per logical sector
      2048 bytes per cluster
         1 reserved sector
First FAT starts at byte 512 (sector 1)
         2 FATs, 12 bit entries
      1024 bytes per FAT (= 2 sectors)
Root directory starts at byte 2560 (sector 5)
       512 root directory entries
Data area starts at byte 18944 (sector 37)
       502 data clusters (1028096 bytes)
32 sectors/track, 64 heads
         0 hidden sectors
      2048 sectors total
Checking file /single
Checking file /FILE.TXT
Checking for unused clusters.
single.img.orig: 2 files, 1/502 clusters

Options:

  • -l: list path names of files being processed
  • -n: no-operation mode: non-interactively check for errors, but don’t write anything to the filesystem
  • -v: verbose

malloc lab results

The points computed by mdriver are not absolute but depend on the machine where the test is run as they depend on an evaluation of the installed libc performance. You might therefore notice different results for your lab. All the labs are tested on the same machine and evaluated using the same libc performance values.

Sample solutions for the malloc lab

Some sample solutions and examples for the malloc lab are availble.

mm-naive.c The simplest solution: malloc simply sbrk’s and writes a size header. free does nothing. realloc is implemented directly with malloc and free. This solution has great throughput but terrible space utilization, and thus fails on many traces because it exhausts memory.
mm-implicit.c Solution based on coalescing implicit free lists with boundary tag. This is the simplest reasonable package.
mm-explicit.c Solution based on explicit free list with boundary tag coalescing and first fit placement.
mm-tree.c Highly optimized solution based on red-black trees.
mm-test.c A buggy malloc that produces overlapping blocks. Used for testing the driver.