CC = gcc# compilerCFLAGS = -Wall -g# compile flagsLIBS = -lpthread -lrt# libsall: ks_client ks_serverks_client: ks_client.o$(CC) -o ks_client ks_client.o $(LIBS)ks_server: ks_server.o$(CC) -o ks_server ks_server.o $(LIBS)%.o:%.c$(CC) $(CFLAGS) -c $*.cclean:rm -f ks_server ks_client *.o *~Link added to help with message queues:http://beej.us/guide/bgipc/output/html/multipage/mq.htmlUsing UbuntuProject DescriptionYou will design and implement a keyword search server, that will take a single keyword and a directoryname from a client and will search the keyword in all the files sitting in a given directory usingmultiplethreads. You will also implement the client program. There may be several client processes requestingservice from the server process. The client processes and the server will communicate using messagequeues. The client program will be named as ks_client (keyword search client) and it will taketwo parameters:1. A keyword that is expressed as a single word, starting with a whitespace character and endingwith a whitespace character, not including any whitespace character in the middle. A whites-pace character is either a , , or character. There will be noempty word specified.2. A directory name (full path)Hence a client program can be invoked as follows:./ks_client keyword dirpathA client process that is invoked with those parameters will first attach to the server master messagequeue identified by a key derived from a file named by the given pathname and a nonzero integervalue. The server will use the master message queue to receive requests from the client processes.Since you are the programmer of both the client and the server, you will decide this pathname andthe integer parameters of ftok to uniquely identify a message queue. For instance, you can use thename of server program and the integer 1 in both client and server to create a key as follows:ftok(‘ks_server.c’, 1)See the man page of the ftok for more details on obtaining a key. See also the msgget functionto learn how to get a message queue identifier using the key returned by the ftok function.After attaching the server master message, the client will generate a request message and includethe keyword and dirpath in that message. The generated message will be sent to the server via themaster message queue. The server must have created the master message queue earlier. Therefore,the server must be started earlier than the client.The name of the server program must be ks_server (keyword search server). It will take noparameters. As in the client case, a key will be used to create the server master message queue viathe msgget function. Parameters used in ftok function should be the same in both client and theserver to connect tp the same message queue. The server will be invoked as follows:./ks_serverand it will run silently in the background. The server process will not produce any output to thescreen. The output will go via message queues to the client processes. When the server process getsa request from a client process, it will create a child process that will handle the request. The requestis just a message that is received via a message queue. The request includes the keyword and the fullpath of the directory which includes multiple files to be searched. The child process that is createdwill handle the request. For every file in the directory, the child process will create a correspondingthread that will handle the search operation in that file.The thread will search the given keyword (i.e. will try to exactly match the entire word only) inthe file that it is assigned. While searching the file, if the thread encounters the keyword as an entireword in a line, then the thread will record the file name, line number, and the line itself (exluding thenewline character at the end) into a message. That message will be sent to the client process. If thekeyword is seen, for example, in 5 separate lines, then 5 separate messages will be created. Receivedmessages by the client will be printed to the screen in the following format:::For example, if the keyword is ‘a’ and the content of the file to be searched (assume the file nameis file1.txt) is as follows:I raised my daughter in the Americanfashion; I gave her freedom, buttaught her never to dishonor herfamily. She found a boy friend,not an Italian. She went to themovies with him, stayed out late.Two months ago he took her for adrive, with another boy friend.They made her drink whiskey andthen they tried to take advantageof her. She resisted; she kept herhonor. So they beat her like ananimal. When I went to the hospitalher nose was broken, her jaw wasshattered and held together bywire, and she could not even weepbecause of the pain.Then, the client will print the following output to the screen:file1.txt:4:family. She found a boy friend,file1.txt:7:Two months ago he took her for aIf the keyword is seen more than once in a line, then a single message will be created for that line.For example, if we had a line as ‘a a a’, then the number of matches on this line would be 3. However,we have to report such a line only once (i.e. generate a single message and print the line to the screenonly once).All threads that are searching a certain file existing in the given directory will do the same thing.Hence, they will return the result to the client process in messages via the message queue(s) that is(are) created between the server process and that client process for sending replies. The number ofmessage queues that you will create for this purpose is upto you.The client process will receive such messages. When the server finishes searching the whole tree,it will send a special message to the client indicating the end of the search operation. Similarly,a special keyword called exit will be used to shut-down the server. When server receives the exitkeyword, then it will not search that keyword but remove the master message queue and terminate.Similarly, the client will not wait output messages from the server if the exit keyword is sent to theserver.The user should be able to start up more than one client at the same time. In this way, severalsearch requests may arrive to the server at the same time and the server has to create several childprocesses in this case. Each child process will handle one client’s request. Handling a request maycause several threads to be created from that child process.Constants and TipsYou can make the following assumptions on the keyword size, directory path size, line size, and thefinal result size in terms of the number of characters they include:1. KEYWORDSIZE = 322. DIRPATHSIZE = 1283. LINESIZE = 10244. RESULTSIZE = 2048Also, remember to use thread-safe library functions inside your threads! (for instance strtok_r()instead of strtok()).What to Submit1. ks_client.c: including the source code of the client.2. ks_server.c: including the source code of the server.