•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,470 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,802 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 436 | Replies: 1
![]() |
•
•
Join Date: Mar 2008
Posts: 11
Reputation:
Rep Power: 1
Solved Threads: 0
I have two program problems:
a program that generates this file writing zeros for PID
and TIME and random numbers in the 8 pozitions of the DATA
field.
and
program that will create at least 3 child
processes, each of which will repeat at least 10 times the
following operations on the file given above. Each child
process will generate a random number STEP between 1 and
10. The child process will process all the records on
positions multiple of STEP. Every number in the DATA field
will be added he largest power of 5 smaller than it. The PID
and TIME fields will be modified accordingly. To avoid
interference among the processes, all the records to be
processed will be locked beforehand using lockf(). After the
processing of the records is over, they will be unlocked. Lock
the records in the order they are stored inthe file. Then, try
to lock them in an arbitrary order and possibly add a second
delay after each lock is applied.
a program that generates this file writing zeros for PID
and TIME and random numbers in the 8 pozitions of the DATA
field.
and
program that will create at least 3 child
processes, each of which will repeat at least 10 times the
following operations on the file given above. Each child
process will generate a random number STEP between 1 and
10. The child process will process all the records on
positions multiple of STEP. Every number in the DATA field
will be added he largest power of 5 smaller than it. The PID
and TIME fields will be modified accordingly. To avoid
interference among the processes, all the records to be
processed will be locked beforehand using lockf(). After the
processing of the records is over, they will be unlocked. Lock
the records in the order they are stored inthe file. Then, try
to lock them in an arbitrary order and possibly add a second
delay after each lock is applied.
•
•
Join Date: Mar 2008
Posts: 11
Reputation:
Rep Power: 1
Solved Threads: 0
the file should be a binary file containing 100 records of 38 bytes each
with the following format:
+--------+------+-----------------------------------------------+
| Bytes | Name | Content |
+--------+------------------------------------------------------+
| 0 - 1 | PID | PID of the last modifier process (short int) |
+--------+------+-----------------------------------------------+
| 2 - 5 | TIME | Time of the last chage in milisec (long int) |
+--------+------+-----------------------------------------------+
| 6 - 37 | DATA | Sequence of 8 natural numbers (int) |
+--------+------+-----------------------------------------------+
with the following format:
+--------+------+-----------------------------------------------+
| Bytes | Name | Content |
+--------+------------------------------------------------------+
| 0 - 1 | PID | PID of the last modifier process (short int) |
+--------+------+-----------------------------------------------+
| 2 - 5 | TIME | Time of the last chage in milisec (long int) |
+--------+------+-----------------------------------------------+
| 6 - 37 | DATA | Sequence of 8 natural numbers (int) |
+--------+------+-----------------------------------------------+
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- memory management in wndows 2000 (Windows NT / 2000 / XP / 2003)
Other Threads in the Shell Scripting Forum
- Previous Thread: Sort command issue
- Next Thread: Help in creating a user in Multiple servers


Linear Mode