Lists of Things
To get started, step into the src directory:
cd src
To build the code, run make
, which should create four binaries: pthread
, words
, pthread_words
, and list_words
. Make sure not to commit and push any binaries when submitting to the autograder. You can get rid of unnecessary binaries using make clean
.
You do not have to add the
-f
flag to run the executable in this assignment.
Skeleton
You’ll notice that for some files, only the object files without the source are provided. Part of being able to program means being able to work with the abstractions you’re provided, so we’ve left out implementations which are not necessary for you to complete this assignment.
list.h
provides the PintOS list abstraction which is taken directly from the PintOS source code. list.c
provides the implementations, but you should be able to use this library solely based on the API given in list.h
. You must not modify these files.
word_count.h
defines the API you will implement. We have already provided necessary data structures word_count_t
and word_count_list_t
which you must use. Please read the comments in this file carefully as those define the semantics of the functions you will have to implement for the tasks list_words
and pthread_words
.
words.o
and word_count.o
provide compiled implementations of methods necessary to run the words
program from Assignment 0. You can use the outputs of these programs as sanity checks on what your other programs that you’ll build should output.
word_count_list.c
will house your implementation of the the API in word_count.h
using PintOS lists. The Makefile
will provide the macro definition of PINTOS_LIST
when compiling. When word_count_list.c
is linked with the driver in list_words.o
and compiled, it should result in an application list_words
that behaves identically to the frequency mode of words but internally using PintOS lists instead of traditional linked lists as seen in Assignment 0.
Similarly, word_count_pthread.c
will house your implementation of the API in word_count.h
using PintOS lists and proper synchronization of the word count data structure for a multithreaded program. Unlike list_words
, you’ll need to write the driver program in pthread_words.c
. When word_count_pthread.c
and pthread_words.c
are put together and compiled, it should create an application pthread_words
that behaves identically as list_words
and frequency mode of words
but internally uses multiple threads.
word_helpers.h
provides an API for parsing and counting words. word_helpers.o
provides compiled implementations for these methods.
pthread.c
implements an example application that creates multiple threads and prints out certain memory addresses and values. You may find it helpful to base your pthread_words.c
implementation off of pthread.c
. While you won’t be writing any code in pthread.c
, you will be reading and analyzing it.
Next up: list_words.