Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions