Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab Exercises 1. Write a python program which do the following 1.1. Creates one process, this process must ask the user to enter a valid

image text in transcribed
image text in transcribed
Lab Exercises 1. Write a python program which do the following 1.1. Creates one process, this process must ask the user to enter a valid ip address. A valid IP address must be in the form of A.B.C.D, where A,B,C and D are numbers from 0-255. The numbers cannot be o prefixed unless they are 0. 2. Write a python program which do the following: 2.1. Create two processes and one queue. 2.2. The first process must put commands into the queue. The commands are 2.2.1. id 2.2.2 whoami 2.2.3. pwd 2.2.4. Is 2.2.5.cat 2.3. The second process must get the elements from the queue and execute them using the os module. If the command is cat, then the script must ask the user for the file name to view its contents. 2.4. Note: Don't forget to use a proper lock to prevent any errors in the code 3. Using Pool( do the following: 3.1. The pool must have 2 processes, each process will pass two parameters to a search function, these parameters must be the name of the file and a word to search for these two parameters must be entered by the user and must be different from the process to another. 3.2. The Search function must search for the word in the file and if the word is found then find out the number of occurrences for this word otherwise return that the word doesn't appear in the file. 3.3 You need to verify that the file the user input is actually a file and it exists in the system

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

MySQL/PHP Database Applications

Authors: Jay Greenspan, Brad Bulger

1st Edition

ISBN: 978-0764535376

More Books

Students also viewed these Databases questions