Question: Required tool: c program, Linux , pthread_create(), pthread_join(), pthread_attr_setdetachstate(), Suppose you have a doubly link list which each node has a pathname. Write c program


Required tool:c program, Linux, pthread_create(), pthread_join(), pthread_attr_setdetachstate(),

Suppose you have a doubly link list which each node has a pathname.

Write c program to find the number of occurrences of the given keyword in each pathname. Create another variable in each node to record number of occurrences. If the pathname is a directory(folder), record 0. Also, give user 2 search options. First search option is to be performed by the main thread. For second search option, a new thread will be created for every file to be searched, and the search will be performed by this new thread while the main thread continues traversing and creating new threads for new files being encountered.

Sample input:

Suppose problem.c is the file.

Users command line:

gcc -o problem -g -Wall problem.c

./problem keyword 0/1

(keyword is a word to be search, o is the first search option, 1 is the second search option)






Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!