You will be working alone for this project. This specification is subject to change at anytime for additional clarification. For this project, you will be implementing a virtual machine threading API in either C or C++. Your virtual machine will be tested on the CSIF machines. You must submit the provided source code (including apps), your source files, readme and Makefile in a tgz file.
You will be provided a machine abstraction upon which you will be building the thread scheduler. The virtual machine will load the “applications” from shared objects that implement the VMMain function. The virtual machine will need to support multiple user space preemptive threads. Threads at the same priority level will time share with a quantum of one tick. The virtual machine file access is provided through the file API. Threads have three priority levels low, medium, and high. Threads are created in the dead state and have and have state transitions as shown below.
1. I/O, acquire mutex or timeout
2. Scheduler selects process
3. Process quantum up
4. Process terminates
5. Process activated
6. Process blocks
A makefile has been provided that compiles the virtual machine as long as you provide your code as VirtualMachine.c or VirtualMachine.cpp. Do not modify any of the other files, just create your VirtualMachine.c or VirtualMachine.cpp file. It will create the virtual machine call vm. The applications can be built by making the apps with make apps. New apps can be built by adding a C or C++ file in the apps directory and adding $(BINDIR)/filename.so to the Makefile apps line dependencies.
You will be adding to the virtual machine a mutex API which provides a synchronization mechanism.
The MachineFileRead and MachineFileWrite functions require that shared memory locations be used to transfer data to/from the machine. In addition the maximum amount of data transferred must be limited to 512 bytes. VMFileRead and VMFileWrite must still be able to transfer up any number of bytes specified.
The vm syntax is vm [options] appname [appargs]. The possible options for vm are -t, and -s; -t specifies the tick time in millisecond, and -s specifies the size of the shared memory used between the virtual machine and machine. By default the tick time is set to 10ms, for debugging purposes you can increase these values to slow the running of the vm. The size of the shared memory is 16KiB. When specifying the application name the ./ should be prepended otherwise vm may fail to load the shared object file.
The machine layer is implemented using a cooperative process that communicates using the System V message queues. As such during your development your program may crash prior to the closing of the message queues. In order to determine the message queue id, you can use the ipcs command from the shell. You can remove the message queue with a call to ipcrm. You can read more about the System V IPC commands at: http://man7.org/linux/man-pages/man1/ipcs.1.html http://man7.org/linux/man-pages/man1/ipcrm.1.html
The function specifications for both the virtual machine and machine are provided in the subsequent pages.
You should avoid using existing source code as a primer that is currently available on the Internet. You must specify in your readme file any sources of code that you have viewed to help you complete this project.
Helpful Hints
#include "VirtualMachine.h" extern "C"{
TVMStatus VMStart(int tickms, int argc, char *argv[]){
}
...
TVMStatus VMFileWrite(int filedescriptor, void *data, int *length){
...
}
}
VMMain app entry point.
When updating the machine interface, you may want to use a wait queue similar to that of your mutex. It may be possible that the amount of shared memory available has been used up by all of the other threads
Beginning VMStart
At the very beginning to get hello.so working you will want your VMStart to do the following in order:
As you add more functionality you will be inserting more code at various points in VMStart
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme