Operating system threads and a thread-safe hashtable in c programming
a classic problem in text processing is identifying the unique words. it doesn’t seem to hard: open a file, read it a word at a time, stick it in a hashtable, dump the hashtable when done. it gets a bit harder when we want to do it fast!for this program we are going to use threads and a thread-safe hashtable. your program will take a list of files. it will create a thread that will process each file in parallel. (the in parallel part is important; we want to do this fast!) as each thread reads a word, it will look up the word in the hashtable and add it if it is not there. since threads will be accessing the table concurrently, we need to make it threadsafe. 29.4 of the book talks about concurrent hashtables. please use 256 buckets and make sure you do per bucket locking. (do not lock the whole hashtable.) you can use a tree or linked list to keep track of elements in a given bucket.use fscanf to read the words of a file. “%ms” is a GNU extension to fscanf that will take care of allocating space for words that are read. for example,will read in a word and allocate enough space to hold the word and assign ptr to the allocated space. you will need to make sure that ptr is free()’ed when you are done using it.your program (uc.c) will take a list of filenames from the program arguments. you will output a single number: the total number of unique words (just a single number). the only other thing that your program will print out is a error (using perror) for each file that could not be opened.(there is no limit to the number of filenames. you will certainly be tested with more than 5!)800wordsof797 400wordsof300 1100wordsof599.
Are you busy and do not have time to handle your assignment? Are you scared that your paper will not make the grade? Do you have responsibilities that may hinder you from turning in your assignment on time? Are you tired and can barely handle your assignment? Are your grades inconsistent?
Whichever your reason may is, it is valid! You can get professional academic help from our service at affordable rates. We have a team of professional academic writers who can handle all your assignments.
Our essay writers are graduates with diplomas, bachelor, masters, Ph.D., and doctorate degrees in various subjects. The minimum requirement to be an essay writer with our essay writing service is to have a college diploma. When assigning your order, we match the paper subject with the area of specialization of the writer.