Operating Systems - Chapter 2 - Operating-System Structures
How to use process control system calls
If we create a new job or process, we should be able to control its execution. This control requires the ability to determine and reset the attributes of a job or process, including the job's priority, its maximum allowable execution time, and so on (get and set process attributes). We may also want to terminate a job or process that we created (terminate process) if we find that is is incorrect or is not longer needed.
What makes a java virtual machine. How does it works
It consist of a class loader and a java interpreter that executes architecture-neutral bytecodes. - The class loader loads the compiled .class files form both the Java program and the Java API for execution by the Java interpreter. - after a class is loaded, it verifies that the .class file is valid Java bytecode and doesn't perform pointer arithmetic, which could provide illegal memory access. If the class passes verification , it is run by the java interpreter.
What is an API
Most programmers never see the level of detail that takes place in the OS with the use of system calls. Typically, developers design programs according to an API = APPLICATION PROGRAMMING INTERFACE. - The API specifies a set of function that are availabel to an application programmer, including the paramenters that are passes to each function and the return values the programmer can expect. - The most common API's are: Win32, POSIX API (for unix, linux, and mac os x), and the Java API for designing programs that run on the Java virtual machine. - Behind the scenes, the function sthat make up an API typically invoke the actual system calls on behalf of the application programmer.
What are shells?
On systems with multiple command interpreters to choose from the interpreters are known as SHELLS. Most shells provide similar functionallity, and a user's choice is generally based on personal preference.
How to use the lock system calls
Quite often, 2 or more processes share data. to ensure the integrity of the data being shared, OS's often provide system calls allowing a process to lock shared data, thus preventing another process from accessing the data until the lock is removed. Typically such system calls include acquireLock and releaseLock.
read()
ReadFile()
ioctl()
SetConsoleMode()
alarm()
SetTimer()
Why would an application programmer prefer programming according to an API rather than invoking actual system calls?
Several reasons: - Program portability: a program using an API can expect to compile and run on any system that supports the same API (although in reality, architectural differences often make this more difficult than it may appear). - Actual system calls can often be more detailed and difficult to work with than the API available to an application programmer.
sleep()
Sleep()
What does the status information System program do
Some simply ask the system for the date, time, amount of available memory or disk space, # of users, etc. - Others. provide detailed performance, logging, and debugging info.
What is a system call, how else this is called.
Sw may trigger an interrupt by executing a special operation called a SYSTEM CALL, also called a monitor call. (examples of system calls in page 55) - Even simple programs may make heavy use of the OS. Frequently, systems execute thousands of system calls per second.
What is the Garbage Collector
The Java Virtual Machine (JVM) also automatically manages memory (memory leaks) by performing garbage collection: the practice of reclaiming memory from objects no longer in use and returning it to the system.
What does the Java Development Kit does
The compiler turns a Java source file program into a bytecode (.class) file. - The run-time environment provides the JVM as well as the Java API for the host system.
what is a system call interface
The run time support system (a set of function built into libraries included with a compiler) for most programming languages provides a system-call interface. - This system call interface serves as the link to system calls made available by the OS.
What is a command interpreter
There are several ways for users to interface with OS. One provides a command-line interface or COMMAND INTERPRETER: which allows user to directly enter commands to be performed by the OS. The others allows users to interface with the OS via a graphical user interface or GUI. -Some OS include the command interpreter in teh kernel. Others sush as Windows XP and UNIX, treat the command interpreter as a special program that is running when a job is initiated or when a user first logs on.
which are the 6 major types of system calls
They can be grouped roughly into: - process control - file manipulation - device manipulation - information maintenance - communications - protection.
wait()
WaitForSingleObject()
write()
WriteFile()
how does the device manager of the OS works
a process may need several resources to execute. If the resources are available, they can be granted, and control can be retruned to the user process. Otherwise, the process will have to wait until sufficient resources are available. The various resources controlled by the OS can be thought of as devices. A system with multiple users may require us first to REQUEST the device, to endure exclusive use of it. After we finished with the device, we RELEASE it.
What does the programming-language support System programs do
compilers, assemblers, debuggers, and interpreters for common programming languages are oftern provided to the user with the OS.
examples of file management system calls
create file, delete file open, close read, write, reposition get file attributes, set file attributes
examples of communication system calls
create, delete communication connection send, receive messages transfer status information attach or detach remote devices.
What does the file management System program do
create, delete, copy, rename, print, dump, list, and generally manipulate files and directories.
examples of process control system calls
end, abort load, execute create process, terminate process get process attributes, set process attributes wait for time wait for event, signal event allocate and free memory
Into what 6 categories can System Programs be divided
file management status information file modification programming-language support program loading and execution communications
examples of information maintenance system calls
get time or date, set time or date get system data, set system data get process, file, or device attributes set process, file, or device attributes.
How to use the wait system call
having created new jobs or processes, we may need to wait for them to finish thir execution. We may want to wait for a certain amount of time to pass (wait time); more probably, we will want to wait for a specific event to occur (wait event). The jobs or processes should then signal when that event has occurred (signal event).
What is the Java Virtual Machine
it is a specification for an abstract computer.
What does it means for Java to be a multithreaded language.
it means that a java program may have several different threads, or flows, of control, thus allowing the development of concurrent application sto take adantage of modern processors with multiple processing cores. Java is also considered secure language. Which is important considering that a Java program may be executing across a distributed network.
What does the communication System programs do
provide the mechanism for creating virtual connections amoung processes, users and computer systems. - They allow users to send messages to one another's screens, to browse the Web pagees, to send emails, to log in remotely, or to transfer files form one machine to another.
examples of device management system calls
request device, release device read, write, reposition get device attributes, set device attributes logically attach or detach devices.
What makes the JVM so good for working on all OS types
the JVM makes it possible to develop programs that are architecture-neutral and portable. - An implementation of the JVM is system-specific, and it abstracts the system in a standard way to the Java program, providing a clean, architecture-neutral interface. - This interface allows a .class file to run on any system that has implemented the JVM according to its specification.
what is debugging
the activity of finding and fixing errors. or bugs, in a system. Debugging seeks to find and fix erros in both hw and sw. Performance problems are considered bugs, so debugging can also include performance tuning, which improves performance by removing bottlenecks.
For next questions, the question is the system call in UNIX
the answer is the system call in WINDOWS
What is the fundamental idea behind a Virtual Machine
the idea is to abstract the hw of a single computer (the CPU, memory, disk drives, network interface cards, etc) into several different execution environments, thereby creating the illusion that each separate execution environment is running its own private computer. - This is how a single physical machine can run multiple OS concurrently, each in its own virtual machine.
What is the main function of command interpreters or shells?
to get and execute the next user-specified command. Many of the commands given at this level manipulate files: create, delete, list, print, copy, execute, and so on.
When is a new instance of the JVM created
whenever a Java application or applet is run. This instance of the JVM starts running when the main() method of a program is invoked. - In the case of applets, the programmer doesn't define a main() method. Rather, the browser executes the main() method before creating the applet. - If we run 2 java programs and a java applet on the same computer, we will have 3 instances of the JVM.
In which 2 ways are command interpreters (shells) implemented
- In one approach, the command interpreter itself contains the code to execute the command. and the command interpreter jump to a section of its code that sets up the parameters and makes the appropriate system call. In this case the size of the number of commands that can be given determines the size of the command interpreter, since each command requires its own implementing code. - An alternative approach, implements most commands though system programs. In this case, the command interpreter does not understand the command in any way; it merely uses the command to identify a file to be loaded into memory and executed.
What are the 2 essential components of Java
- Programming language specifications: Java is a general-purpose, object-oriented programming language with support for distributed programming. - virtual-machine specification We refer to Java as a technology rather than just a programming language.
Which are the 3 general methods used to pass parameters to the OS
- The simplest approach is to pass the parameters in registers. In some cases, however, they may be more parameters than registers. In those cases, - The parameters are generally store din a block, or table, in memory, an the address of the block is passed as a parameter in a register. - Parameters also can be placed, or pushed, onto the stack by the program and popped off the stack by the OS. Some OS prefer the block or stack method because those approaches do not limit the number of length of parameters being passed.
What are the parts of the Java Development Kit
- the development tools, such as a compiler and a debugger - And a run-time environment or JRE.
How does a system call interface works
- the system-call interface intercepts function calls in the API and invokes the necessary system calls within the OS. - Typically, a number is associated with each system call, and the system-call interface maintains a table indexed according to these numbers. - The system-call interface then invokes the intended system call in the OS kernel and return the status of the system call and any return values.
open()
CreateFile()
pipe()
CreatePipe()
fork()
CreateProcess()
Again, what do System programs do
At the lowest level is the hw. Next is the operating system, then the system programs, and finally the application programs. - System programs, also know as SYSTEM UTILITIES, provide a convenient environment for program development and execution. - Some of them are simply user interfaces to system calls; others are considerable more complex.
close()
CloseHandle()
exit()
ExitProcess()
What can we find in a Java program?
For each Java class, the java compiler produces an architecture-neutral bytecode output (.class) file that will run on any implementation of the Java virtual machine.
getpid()
GetCurrentProcessID()
What is a language-based extensible system
A OS that have been wrote in Java or another language that is not C and assembly language.
What is a crash
A kernel failure. As with a process failure, error info is saved to a log file, and the memory state is saved to a crash dump.