Introduction to Operating Systems Flashcards

1
Q

What are the two main functions of an OS?

A
  • Interact with the hardware
  • Interact with the user
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why are instructions related to I/O devices typically privileged instructions? (can be executed in kernel mode but not in user mode)

A

Restriction is in place for security and protection purposes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the difference between Kernel and User Mode?

A
  • Kernel mode, the CPU has unrestricted access to system resources and can execute privileged instructions
  • User mode, access is restricted and certain operations are prohibited
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does having two distinct modes aid in designing an OS?

A
  • Preventing user programs from interfering with system-level operations
  • Accidentally or maliciously causing system crashes or other errors)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the purpose of system call in an OS?

A

System call provides the services of the operating system to the user programs via the Application Program Interface (API)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an Open System Call, its Syntax and Conditions that cause them to fail

A
  • Initialises access to a file in a file system, also specifies the mode in which the file should be opened (flags) (e.g., read, write, append)
  • May fail due to various factors, file not found, permission denied, invalid pathname
  • int open(const char *pathname, int flags, mode_t mode);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an Close System Call, its Syntax and Conditions that cause them to fail

A
  • Close an open file in an operating system
  • May fail due to invalid file descriptor, interrupted by a signal, I/O error
  • int close(int fd);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an Read System Call, its Syntax and Conditions that cause them to fail

A
  • Read data from a file or other input source into a buffer in user memory
  • May fail due to invalid file descriptor, permission denied, invalid buffer
  • ssize_t read(int fd, void *buf, size_t count);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is an Lseek System Call, its Syntax and Conditions that cause them to fail

A
  • lseek is used to reposition the read/write file offset of an open file descriptor
  • May fail due to invalid file descriptor, unsupported device, invalid whence parameter, out-of-bounds offset
  • off_t lseek(int fd, off_t offset, int whence);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Virtual Machine features

A
  • Isolation, operates independently
  • Resource allocation and virtualisation, share the physical hardware of the host
  • Platform independence, can emulate a different operating system than the host machine
  • Security, provide an isolated environment that can be used to run potentially unsafe applications
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Virtual Machine downsides

A
  • Performance overhead, introduce additional layers between the hardware and the operating system
  • Resource contention, share the physical resources of the host machine, degrade performance
  • Limited hardware access, require direct hardware access, may face limitations or degraded performance
  • Compatibility issues can limit usability for certain use cases
How well did you know this?
1
Not at all
2
3
4
5
Perfectly