I am working on a CPU emulator which on certain preset breakpoints passes some parameters to an OS compatibility layer (like a Wine kind of thing). What this is mean to acheive is that a CP/M program may run in a linux environment, accessing files in the filesystem of the host machine, writing to the terminal of the host computer, and accessing other hardware (actual hardware on the host computer, or emulated) whilst the machine code of the application software itself runs on the emulated CPU.
Both the CPU engine and the OS compatibilty layer are to be written in C.
My problem is this: although I understand the logic behind the problem I'm trying to solve, and could implement it in PDP-8 assembler (if only the PDP-8 were powerful enough! ), I'm still only learning C and don't know about how to do some things integral to this idea's working.
How can I pass a semaphore to another process?
How can several processes have variables and so on in common? When the CPU engine calls the OS compatibility layer for a particular syscall, the OS compat layer will need to look at CPU registers and memory locations for parameters and so on.
How do put proper bullet points into this message?
How can I make several processes communicate in C?
-
- Posts: 8
- Joined: Mon Mar 24, 2008 6:58 pm
How can I make several processes communicate in C?
I take my tea with milk
-
- Member
- Posts: 566
- Joined: Tue Jun 20, 2006 9:17 am
Re: How can I make several processes communicate in C?
you are asking a very general question that , one could fill pages of answer . Can you be more specific ?
Regards
Shrek
Regards
Shrek
Last edited by DeletedAccount on Sat Jan 10, 2009 10:17 pm, edited 1 time in total.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: How can I make several processes communicate in C?
Why would you? If you really need to, use IPC (see the next answer).wilsonsamm wrote: How can I pass a semaphore to another process?
Well, by using IPC. The most common two approaches are message passing and shared pages. I'd suggest shared paged for stuff like common variables. Just be careful about those race conditions Also, you might want to read on transactional memory.How can several processes have variables and so on in common? When the CPU engine calls the OS compatibility layer for a particular syscall, the OS compat layer will need to look at CPU registers and memory locations for parameters and so on.
Use [ list ] [asterisk] foo [asterisk] bar [ /list ]How do put proper bullet points into this message?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
-
- Member
- Posts: 566
- Joined: Tue Jun 20, 2006 9:17 am
Re: How can I make several processes communicate in C?
pipes , message queues.... , even by using sockets on loopback ... So i would prefer a more specific query . Also mention the operating system under considerationThe most common two approaches are message passing and shared pages
Regards
Shrek