Ok so here is my problem, i have to write a simple computr system consisting of the processor and the memory,

The project will simulate a simple computer system consisting of a CPU and Memory.
The CPU and Memory will be simulated by separate processes that communicate
I have to use unix fork to create child processes and a pipe so that both the memory and processor can communicate

My idea is to start of with 2 classes the processor class and the memory class , but am not sure how the forking will work. The pipe i have some idea but its also a bit blurry , hence i never used this two before. I also have the choice of usign java and runtime but i want to try on c++ to get more experience.

Recommended Answers

All 2 Replies

RTFM. Use fork()/exec() functions to create a child process, which will then communicate with the parent process via pipes or TCP/IP connections.

In any case, start by modeling how the processor and memory will work/interact. Until you determine that behavior, anything else is a waste of time. FWIW, I taught a bunch of grade-school children how to build a stack machine (processor and memory) back in 1985, just like you are tasked with now. If they can handle it, you can too!

thanks kind of got the hang of it , time to code!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.