Comp Sci Which Language Handles Thread Operations Better for File Manipulation?

  • Thread starter Thread starter kings1703
  • Start date Start date
  • Tags Tags
    C++ Java Threads
AI Thread Summary
The discussion centers on a request for assistance in writing a program that utilizes five threads to manipulate a shared file, where even threads write and odd threads delete. The main concern is ensuring the final file output is correct without race conditions. Participants emphasize the importance of using a mutex to protect the shared resource during thread operations. The requestor expresses urgency due to impending deadlines for multiple assignments. Overall, the conversation highlights the challenges of thread management in file manipulation tasks.
kings1703
Messages
4
Reaction score
0
Java or C++ - Threads HELP!

I need help with this program. I got five others to do and I won't have time to do it and it's apart of my final exam for next Tuesday, can somebody write this program:

Create 5 threads which share a file and
let "even" threads write to a file, and let "odd" delete from a file.
Cycle 5 threads for 10 times. Make sure final file gives correct output. (no race conditions)

Please help me out can someone write the program!

Homework Statement


Homework Equations


The Attempt at a Solution


Homework Statement


Homework Equations


The Attempt at a Solution

 
Last edited:
Physics news on Phys.org


What exactly is your question? "Help me out" is not a very specific request.

The problem described appears to basically be a funny way of saying "Demonstrate you know how to use a mutex". The file described is a resource which needs to be protected by a mutex. The threads perform operations on this resource which they should hold the mutex in order to perform.
 


my question was can someone write this program, I just finished this phat *** program last night and I still got two more to go
 

Similar threads

Replies
15
Views
3K
Replies
2
Views
3K
Replies
3
Views
4K
Replies
6
Views
3K
Replies
2
Views
4K
Replies
10
Views
11K
Back
Top