I am researching ideas for a PhD project.
One of my thoughts is writing a hypervisor (or bare metal) (?) so I could run multiple OS's without use of a true host operating system. Example I get a menu of some type of options to start operating systems, view what the 'console' of what is going on in an OS that is already running. Reboot OS's, install a new one, etc.
So no host OS, just a small app that controls everything.
Conceptually how does one think about doing this?
I have a MacBook. I should be able to modify what the EFI boots. Maybe start with a very minimal Linux LIve implementation and scale it really, really far back?
Is it possible to use Darwin and scale it very far back?
Your idea as stated is not an original contribution to the science.
My advice is to review Xen and the general hypervisor literature, dating back to the '60s &
'70s when IBM invented it.
I'm certain there is room for improvement and original ideas there.
In terms of actually writing a hypervisor, you should review Wikipedia first, as it gives a good brief on virtualization.
Here is a historical summary, including some seminal citations: http://www.kernelthread.com/publications/virtualization/. Note the first citation is from 1959!
Scaling back an existing desktop/server OS seems like a poor choice. OTOH, rather than redo everything, it may be useful to start with an embedded RTOS such as ecos or L4 to draw some features from. Additionally, some code could possibly be re-used from QEMU.
If I were doing it, I would focus on hardware virtualization using VT-x and AMD-V ignore dynamic recompilation (unless was to be the focus of your work).
Also, it seems to me that it would be a good idea to already be able to write operating systems enough to make some small test operating systems that can boot on bare hardware to use for testing the hypervisor under development.
BTW, if scaling back an existing OS was a good strategy, I think it would work best on Linux or one of the major BSDs. Using Darwin is likely asking for pain.
Scaling back an existing OS to develop a hypervisor seems an unlikely approach.
Definitely have a look at some of the existing open source hypervisor project out there.
If you are interesting in reading about how they work and how you might approach writing
one then you could try:
Virtual Machines by Smith & Mair.
The Definitive Guide to the Xen Hypervisor by Chisnall.
If you are going to write it from scratch, and you are targeting the x86 family of processors then you are going to have to get your hands dirty with virtualization instructions (eg. Intel VT-x). And this will be with pure assembly language, or at best inline assembly. You are talking real low level stuff here.
If you are interested in computer communication and hypervisiors what about cross OS communication [it would be cheaper than trying to connect via normal TCP/IP sockets.
ESX is essentially a scaled-back Linux install - with a host of other goodies added: so your basic premise is decent.
However, for a PhD project, it sounds too broad: you should focus on something smaller.
Related
I just want to known how to get BIO information in C++. I tried following option but each one has its drawback.
From Registry: But I found some system where HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS is missing may be it is virtual machine.
Using WMI: But It is not necessary that WMI will run on all the systems, because in certain cases either the service is disabled or the WMI object is missing!!
I need one permanent solution that gives me BIO information in c++.
Trying to detect if you are in a virtual OS is done in various ways and depends on the virtualization software being used.
There are many different questions about this already on stackoverflow.
In no particular order, here are some articles, they cover a variety of the different virtualization pieces used:
Detect virtualized OS from an application?
detect if application running on virtual box
64-bit windows VMware detection
How to identify that you're running under a VM?
http://www.codeproject.com/Articles/9823/Detect-if-your-program-is-running-inside-a-Virtual
Whilst Salgar beat me to it, one of the more "safe" methods is to use the CPUID instruction, which generally works on modern VM's. I know that KVM, Microsoft and Xen uses a CPUID leaf around 0x40000000 that gives back "You are in a virtual machine". Not 100% sure if VMWare also supports the same one - on a "real" machine, these are reserved and not used.
Here's a page that discusses several options besides CPUID:
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/detecting-x86-virtual-machines.html
and there are several links for further reading.
I have developed an application with c++ on Vista. It works OK. But Now I want to be sure that it works on XP, on Windows 7, and later may be on some types of linux. What good methods do developers use for this task?
There is no substitute for actually running it on the platform itself. If you cannot afford to have separate machines dedicated to each platform then you need to:
Partition the disk(s) on a single machine and install each O/S in its own partition, and multi-boot between them.
Use virtualization software like VMWare or VirtualBox (free!) to set-up each O/S under your host O/S
If your application make little or no use of graphics (or other) hardware then the latter option is a real possibility; if it does use this hardware extensively then you have little choice but to go for the former option.
I use vmware. You can also use VBox or something similar. If you use visual studio along with vmware workstation you can even remote debug your application running in the VMWare.
Obviously keeping to the standard in C++ helps for portability to linux.
go and get a virtual machine player and have functionnal virtual machines for each OS you will test.
Execute the same unitary test scenarii on all the virtual machines.
Don't hesitate to focuss on what may be implemented differently on each plateform:
Save/Load dialogs
Remote communication
Drag'n'Drop
that's what come to my mind, there maybe thousands of other issues.
Anything really really low level (with inline asm code for eample) may be impacted by OS change.
I've tried a few Asus Ones, and found that even switching between multiple windows could take seconds. Is there anything powerful enough in that form factor for C++ programmers to build small to moderate size projects?
I also give it a qualified yes.
What OS you use may matter a lot. I have Kubuntu on a HP 2140 netbook with only 1 gb of ram and the usual Asus N270 cpu. And it is actually rather snappy for window or desktop switches etc under KDE 4.3.
Compile-times are ok but I am spoiled by better machines at the office or even at home. But I got this for the form factor and I take it with me while commuting. I mostly edit, write docs, etc pp while I am on the train and then commit back to SVN at the other end. That works well for me, including the occassional make or make check.
It depends on what compiler and editor/IDE you decide to use. The wimpiest Netbook is still a killer machine compared to what we used 20 or even 10 years ago. One of the easiest routes to better performance is to use an older editor/IDE (the compiler itself will probably be all right). Of course, we expected slower compilation back then too, but even so a minute to switch between windows would have been excessive.
Perhaps the HP Mini note? Amazon Link
You could also try to compile with the Nice command, which will supposedly only do intensive things during the moments when your not using your computer much.
I have an eeepc and it's okay for compilation. I definitely wouldn't want to compile a complete Boost build on it. It works, but you're kind of slumming it. P4 speed, slow hard drive, small amount of RAM... less everything.
A low-quality netbook has more resources and capabilities than my development workstations did a decade ago. What you will need, however, is RAM. If you try to do too many things at a time on one of these things you will swap like crazy because modern software and modern operating systems are written by lazy, slack developers who think RAM is a limitless resource. Alternatively you can boost your RAM. My wife's netbook got boosted to 1GB before the unit was even taken home and it's not at all bad.
I've been developing Microsoft Windows based applications (both desktop and web) for several years using C#, .net, & Visual Studio with a dash of C/C++ & WIN32. I want to broaden my horizons and try out developing in a *NIX environment e.g. using Vim & C++. I have limited UNIX experience from a few school projects.
I'm having trouble thinking of a good project to implement that might reveal some of UNIX's strengths and why some projects / fields prefer to use UNIX. I can think of several interesting things I'd like to build, but don't see compelling reasons to why implementing them in UNIX would be anything more than an exercise in using the UNIX environment.
What project / application could help a developer learn UNIX’s strengths?
Ideally, at some point while I"m coding this project, a light bulb will appear floating above my head, turn on by itself, and I will say "AHA!" when I realize some of the benefits of the UNIX environment compared to things I've done previously in Windows.
Just to be clear, I do not doubt that UNIX has its strengths, I'm just looking for an enticing starting point for Unix development.
In UNIX/Linux "everything" is files. What about writing a piece of software that reads the disk device, understands the partition tables and file system?
Another possibility is to write a linux kernel module that does "something". It will sure give you a better understanding on how the linux kernel works. As an added benefit it sounds more hardcore than it really is ;)
A good starting point would be Kernel Newbies.
Here's one idea: Write a (simple) game, and maintain a "high score list" in some public directory in such a way that ordinary users can view the scores, but not modify them directly (only through the game program itself).
Doing this will show how Unix file permissions and setgid work. It's worth thinking about how you might implement the same functionality in Windows.
You could write some server application, utilizing nonblocking IO, and mechanisms such as epoll, kqueue or /dev/epoll to be able to handle high volume traffic without using any threads.
It's more how you work that will influence you more than anything. A nice multithreaded app of some kind will show off the generally better threading performance, though.
You might consider a project involving parsing large amounts of text.
EDIT: In which case you should choose a language (like Perl) more appropriate for text-processing.
Sure, this could be done with MS tools, but since most MS applications employ proprietary binary file formats (I'm generalising here) the emphasis in Windows is on applications which manipulate MS's own formats.
A project which forced you to consider the text-processing capabilities of Unix tools might be most useful in revealing Unix's strengths.
I need to port a c/c++ codebase that already supports Linux/Mac, to VxWorks. I am pretty new to VxWorks. Could you let me know what are the possible issues that could arise?
We recently did the opposite conversion - we ported code from a PowerPC machine running VxWorks to an Intel system running Linux. I don't remember hitting many snags as far as the differences between the operating systems. Obviously any call to an OS specific API will have to change and we were not making extensive use of these functions.
Our biggest problem was not the difference between the operating systems, but rather the difference between PowerPC and Intel hardware. PowerPC is Big Endian and Intel is Little Endian. Our software is written in C and made many assumptions as to the order of bytes and this was an absolute nightmare to get it working smoothly again. There were literally hundreds of structures that defined bitfields and needed to be re-ordered to work correctly. We ended up implementing a #pragma in GCC that reversed these bitfields at their definition (#pragma reverse_bitfields).
Much depends on which version of VxWorks you're targeting, and the actual target processor itself. One thing you will have to deal with is that there is no paged memory system or virtual memory--you have what's there. The environment itself is far more constrained than a linux system. Sometimes the work involved in porting applications goes all the way back to the architecture level because resources are not as unlimited as they are in linux.
Some other tips:
license vxworks such that you have the source code available
use a real, physical target as soon as possible in the development cycle; do not count on the simulators accurately emulating the target
use TSRs (technical support requests) as necessary; I don't know how they structure the purchase of the right to create TSRs, but don't let anybody cheap out on these
Depending on what processor you are running with VxWorks endianness, structure packing, and memory alignment could all be issues. The last time I used VxWorks it supported a pthreads, sockets, and mutex layer that mimicked the unix environments easily enough.
It's difficult to tell, without knowing more about the application that you're porting: What linux libraries and api calls does it use? Is it self-contained, or does it rely on slews of linux command-line tools and scripts to do its job?
As Average says, endianness can cause you way more problems than you expect - particularly if you're not prepared for it.