C/C++ Creating Threads in Java or C++: Balancing Writing and Deleting in Shared Files

  • Thread starter Thread starter kings1703
  • Start date Start date
  • Tags Tags
    C++ Java Threads
AI Thread Summary
The discussion centers around a programming challenge involving Java or C++ where the user needs to create five threads that share a file. The task specifies that even-numbered threads should write to the file while odd-numbered threads delete from it, cycling through these threads ten times to ensure the final output is correct and free of race conditions. However, the forum community points out that posting homework questions is against the rules, suggesting the user seek assistance on a different platform.
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, so here is my question I need:

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!
 
Technology news on Phys.org


thanks for that
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...

Similar threads

Back
Top