Assignments Flashcards
What are the three primary reasons for an Operating System?
Manage hardware and resources, Provide a user interface, Run and manage applications
privileged instructions
- switch from user to kernel mode
- set the value of a timer
- clear memory
- turn off interrupts
- modify entries in a device status table
- Access I/0 device
Give two reasons why caches are useful
-Caches are useful when two or more components need to exchange data, and the components perform transfers at differing speeds.
-A cache allows a device to run faster.
In order for a cache to be useful, cache _________ must be ensured so that every copy of the datum has a valid up-to-date value.
coherency
Rank the following storage systems fromslowesttofastest
- magnetic tapes
- optical disk
- hard drive disk
- nonvolitile memory
- main memory
- cache
- registers
What is the purpose of interrupts
to change the sequence of instructions executed on the processor.
Direct Memory Access (DMA) is used to offload the CPU when transferring data to and from high-speed I/O devices. How does the CPU coordinate with the device to initiate a DMA transfer?
- The CPU writes values such as the memory address, byte count, and transfer direction into special registers accessible by the DMA controller
- The CPU initiates the transfer, and the DMA controller manages the actual data transfer without requiring the CPU’s involvement.
How does an interrupt differ from a trap?
- interrupts are asynchronous, meaning they can occur at any time, while traps are synchronous and occur during the execution of specific instructions.
- An interrupt is triggered by external hardware events, while a trap is generated by a software or internal event.
What are some key challenges in designing operating systems for mobile devices compared to designing operating systems for traditional PCs?
- Mobile operating systems need to accommodate a wide variety of sensor inputs (such as GPS, accelerometers, and touchscreens) not typically found on traditional PCs.
- Mobile operating systems need to manage more constrained resources, such as battery life, memory, and processing power, compared to traditional PCs.
Match the arguments with whether they support or oppose including applications such as web browsers and mail programs in the operating system.
-Bundling applications ensures better integration with the OS : In favor
- Reduces flexibility and user choice: Opposed
- Simplifies installation and maintenance for users. In Favor
- Can lead to unfair competition for third-party developers: Opposed
- Increases the OS size and complexity, potentially reducing performance: Opposed
- Provides users with essential tools out of the box: In favor
How do clustered systems differ from multiprocessor systems?
Clustered systems are designed primarily for increasing reliability and scalability, whereas multiprocessor systems are primarily used to enhance processing power and performance through parallel processing.
- Clustered systems consist of multiple independent computers (nodes) connected via a network, while multiprocessor systems use multiple CPUs within a single computer sharing the same physical resources like memory and storage.
- In clustered systems, each node operates independently with its own resources, while in multiprocessor systems, CPUs share memory and input/output devices.
What is required for two machines in a cluster to cooperate in providing a highly available service?
-A shared storage system or data replication must be implemented to ensure that both machines have access to the same data and can continue functioning if one fails.
- There must be a mechanism for detecting failures and automatically transferring services from the failed machine to the operational one to maintain availability.
How does a trap to the operating system interact with the CPU’s bit mode, and what role does bit mode play in handling such traps?
A trap, which is a type of synchronous interrupt triggered by an exceptional condition or system call, is handled differently based on the CPU’s bit mode, where user mode and kernel mode operations are distinguished by the bit mode settings.
The services and functions provided by an operating system can be divided into two main categories. Which of the following correctly describes these two categories and explains how they differ?
User Services vs. Kernel Services:
User services provide functionalities like file management and user interfaces, while kernel services manage hardware resources such as CPU scheduling and memory management.
Operating systems use different methods for passing parameters during system calls. Which of the following are valid methods for passing parameters to the operating system?
Pass Parameters in Registers:
The parameters are stored in CPU registers, and the operating system retrieves them directly during the system call
- Pass Parameters on the Stack:
Parameters are pushed onto the system stack, and the operating system pops them off to retrieve the necessary data during the system call.
- Pass Parameters Using Memory Block:
The parameters are stored in a block of memory, and the address of this block is passed to the operating system. The OS accesses the block to retrieve the parameters.
Which of the following methods can be used to obtain a statistical profile of the amount of time a program spends executing different sections of its code?
Utilizing a profiler tool to measure the time spent in each section of the code.
Why does Android use ahead-of-time (AOT) compilation rather than just-in-time (JIT) compilation? Select all that apply.
- Ensures code optimization and consistency across different devices.
- Improved performance by translating the entire application code into native machine code before execution.
- Enhances security by reducing the attack surface.
- Better battery efficiency as AOT compilation consumes less power compared to JIT.
- Reduced startup time since the code is already compiled.
What are the two models of interprocess communication? Select all that apply.
- Message Passing
- Shared Memory
Contrast and compare an application programming interface (API) and an application binary interface (ABI). Select all that apply.
-An ABI defines the low-level binary interface between two program modules, often between an operating system and user programs.
- An API includes function signatures, return types, and parameter types, but does not specify how these are implemented at the binary level.
- An ABI includes details such as calling conventions, machine instruction sets, and binary formats, which are crucial for runtime execution.
- An ABI is concerned with binary compatibility, ensuring compiled programs can work together without recompilation.
- An API defines the methods and data structures developers use to interact with software components.
- An API is concerned with source code compatibility, ensuring that different software components can work together at the source code level.
What is the main advantage of the microkernel approach to system design?
Enhanced security and stability by isolating critical services in user space.
What are the advantages of using loadable kernel modules? Select all that apply.
- They reduce the overall size of the kernel by loading modules only when needed.
- They enable the kernel to be extended without rebooting the system.
Why do Java programs running on Android systems not use the standard Java API and virtual machine? Select all that apply.
- Android uses a different set of APIs optimized for mobile devices.|
- Licensing issues prevent the use of the standard Java API and virtual machine on Android.
- The standard Java API and virtual machine are not designed for the constraints of mobile environments.
- Android’s Dalvik and ART runtimes are optimized for performance and memory usage on mobile devices.
When a process creates a new process using thefork()
operation, which of the following states is shared between the parent and child processes?
Shared memory segment
include <sys/types.h>
Using the program shown below,
#include <stdio.h>
#include <unistd.h></unistd.h></stdio.h>
int value = 8;
int main()
{
pid_t pid;
pid = fork();
if (pid == 0) { /* child process /
value += 15;
return 0;
}
else if (pid > 0) { / parent process /
wait(NULL);
printf(“PARENT:value = %d”,value); / LINE A */
return 0;
}
}
The output after the code atLINE A
executes is ________________.
8