[reposted with HTML removed]
----- Original Message -----
From: Ballard, Jonathan
The idea of common memory between Linux and Windows fascinates me. I hope
to have such concept implemented in coLinux 0.6.3.
Common memory, in computer science, is normally where the hardware devices
and user programs can access the same memory. When we give the hardware
devices direct access to the memory, we eliminate the need to transfer large
amounts of data in synchronous modes. The hardware device can read and
write directly to the memory the program wants instead of some other
mechanism to copy the data out of the device buffer and then copy again into
where the program wants. That extra process to copy data does not allow us
to acheive real asynchronous operations, which common memory does allow.
With virtual machines, we are able to virtualize the hardware devices and
run one program that acts as the hardware and another that is the user
program that wants to use such virtualization. For instance, I have started
to rewrite parts of the console in Cooperative Linux for a proof-of-concept
on common memory between Linux and Windows. This common memory allows
programs that run in the Windows context to access the same memory that
programs in the Linux context can access. We can write virtual hardware in
the Windows context that has direct access to the memory of the program that
run in Linux.
Currently, there are procedures that copy and pass messages back and forth
between the Linux and Windows context. I have attached a patch that updates
cocon to allocate common memory to use as the area to write display
information. Usually a context switch between Linux and Windows happens for
each little display operation. That overhead is reduced with this patch by
the use of common memory. It is reduced to the point when Linux normally
would idle and allow Windows to continue are the display operations
forwarded. Since the common memory is in use, no memory needs to be paged
and no extra data needs to be copied to forward the message. Hence,
performance is gained as less context switches are needed to forward display
Ideally, we want to avoid to need to forward the display operations
entirely. The common memory could be setup between any Linux process and
any Windows process. For example, a Linux process could write directly into
a graphic bitmap that is displayed on the Windows side.
Well, I can share more ideas, but I want to share a sample patch lets you
get a feel of the difference in the responsiveness of coLinux with common
memory. If you want to try the patch, I suggest the command "ls -R /" to
compare before and after.
This patch is in three parts. "concept.bjh.20050202.patch.txt" can be
applied to the colinux source with "patch -p1". "cocon.c" and
"cooperative.h" need to be copied to the linux source:
"linux/drivers/video/console/cocon.c" & "linux/include/linux/cooperative.h".
This patch is not final. It works very well, but its design will change.
Let me know how this works for you if you try it.