If you have notes or messages for me, please put them here so I can see them.
Use this template for Operating Systems Program 3 in Java.
To help you get started quickly, the starter code file includes code to process the two command-line arguments and begin processing the setup file. You have my permission to use, modify, or delete this code. There are also hints about other steps to complete in the main program.
Setup files for the two provided test cases are included in the repository's top-level directory as 424-p3-test1.txt
and 424-p3-test2.txt
. If you are using GitHub Codespaces or Visual Studio Code, I have included predefined run configurations for these test cases using manual or automatic mode.
GitHub Classroom autograding may be enabled for this program, so I would like you to use the following rules to make it easier to compile and run correctly. This template is set up with these rules in mind.
- Your main class must be named
Program3
because GitHub will use the run commandjava Program3
to run your code. You can add, rename, modify, or combine other files as needed. - You will need to add other classes to complete the program, but there's more than one way to do this. Create a class structure that works for you. If you want hints, please ask me; I can give you some.
- Your Java source code files (
.java
files) must be stored in theapp/src/main/java/compsci424/p3/java
directory within your project environment. The Gradle build system will compile all.java
files in this directory when you issue agradle run
command. (On Windows, use backslashes '\' instead of forward slashes '/'.) - Your Java source code files must also include the package declaration
package compsci424.p3;
.
This template uses the Gradle build system to build and run your Java code. All of the major Java IDEs (Eclipse, IntelliJ, and NetBeans) support Gradle, and so does Visual Studio Code. You might need to install a Gradle plugin or change a "Build System" setting in your project settings to enable Gradle. Try it and see what happens.
You may use any standard Java class or feature that is supported in Java 17.
If you are encountering problems, please email me with a description of what's happening. I will look at your repository on GitHub to try to help you debug.
This advice is also posted on the Program 3 page on Canvas. Updates, if any, will be posted there.
- Use the standard Java Thread class, and possibly the Runnable interface, to make your program multithreaded.
- There is a a built-in Semaphore class (
java.util.concurrent.Semaphore
) that you can use in this program, just like in Program 2. - Oracle's Java tutorials provide a good quick introduction to Synchronized Methods along with Intrinsic Locks and Synchronization in Java. You might also want to take a look at other classes in the java.util.concurrent package of the Java API.
- Oracle Java tutorial page on accepting command-line arguments in Java. You may also need to set up some custom build settings in your IDE to provide command-line arguments when you run your code.