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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started