Kernel Programming - Solaris MCQs

Kernel Programming - Solaris MCQs

The following Kernel Programming - Solaris MCQs have been compiled by our experts through research, in order to test your knowledge of the subject of Kernel Programming - Solaris. We encourage you to answer these 90+ multiple-choice questions to assess your proficiency.
Please continue by scrolling down.

1: Which of the following cache entries need to be purged/invalidated if a file is deleted?

A.   DNLC

B.   Page Cache

C.   Buffer Cache

D.   Inode Cache

2: How many LWPs must a process have to maximize its parallelism?

A.   None

B.   Two

C.   It should be the same as the number of processors.

D.   It should be a factor of the available RAM.

3: What are the basic mutex operations supported by the solaris operating system?

A.   Initializing and deinitializing the mutex

B.   Exclusively locking and unlocking the mutex

C.   Reader writer locking semantics on the mutex

D.   Try acquire mutex exclusive

4: Which of the following interfaces are invoked by the OS to flush all data belonging to a filesystem to a disk?

A.   VOP_FSYNC

B.   VFS_SYNC

C.   VOP_PUTPAGE

D.   VOP_WRITE

5: What does the VOP_INACTIVE interface do?

A.   It drops the reference count on a vnode.

B.   It deletes all data associated with a vnode.

C.   It drops the reference count on a vnode and if required it deletes all data associated with a vnode.

D.   It increments the reference count on a vnode.

6: What does the v_vfsmountedhere field of a vnode indicate?

A.   If set to 1, it indicates that a filesystem is mounted on that vnode.

B.   It points to the root vnode of the filesystem to which the vnode belongs.

C.   It points to the vfs structure of the mounted on filesystem.

D.   It points to the root vnode of the mounted on filesystem.

7: Which of the following commands prints out the kernel device tree?

A.   ls

B.   drvconf

C.   prtconf

D.   devlinks

8: Which of the following interfaces is used by the driver to signal the completion of an IO initiated by a strategy call?

A.   biowait

B.   cv_broadcast

C.   biodone

D.   cv_signal

9: The OS guarantees that a thread blocked on a cv via a cv_wait call does not wakeup prematurely and hence does not need to re-check for the reason for blocking.

A.   True

B.   False

10: Which of the following interfaces needs to be implemented for a filesystem to support swap files?

A.   VOP_WRITE and VOP_READ

B.   VOP_GETPAGE and VOP_PUTPAGE

C.   VOP_MAP and VOP_UNMAP

D.   VOP_PAGEIO

11: Which of the following interfaces can be used to avert a thundering herd of waiters?

A.   cv_broadcast

B.   cv_signal

C.   cv_wakeall

D.   cv_wakeone

12: Which of the following components is responsible for speeding up file paths to inode lookups?

A.   Page Cache

B.   DNLC

C.   Buffer Cache

D.   Vnode Cache

13: Which of the following is pageable?

A.   kernel stack.

B.   user addresses.

C.   kernel heap.

D.   kernel code.

14: In which of the following contexts does the solaris kernel handle interrupts?

A.   User context.

B.   LWP context.

C.   On a separate interrupt stack without any special context.

D.   In a kernel thread context.

15: What is the significance of setting the kernel global variable 'kmem_flags' to '0xf'?

A.   It turns on buffer redzone (write past end of buffer).

B.   It turns on freed buffer checking.

C.   It turns on allocator auditing.

D.   It turns on uninitialized data checking.

E.   All of the above

16: Which of the following sequences correctly builds the loadable module 'mymod'?

A.   cc mymod.c

B.   cc -o mymod.o mymod.c; ld -o mymod mymod.o

C.   cc -D_KERNEL mymod.c

D.   cc -D_KERNEL -o mymod.o; ld -r -o mymod mymod.o

17: What does the vfs_vnodecovered field of a vfs structure indicate?

A.   It points to the mounted on directory's vnode structure.

B.   It points to the root inode of the filesystem.

C.   It points to the root directory of the parent filesystem.

D.   It points to the vfs structure of the parent filesystem.

18:

Which of the following calls fits in at 'statement xxx'

to produce correct results in the code snippet below?

mutex_enter(mutex pointer);

while (condition is false) {

      cv_wait(cv pointer, mutex pointer);

}

statement xxx;

mutex_exit(mutex pointer);

A.  

mutex_enter(mutex pointer)

B.  

mutex_exit(mutex_pointer)

C.  

nothing needs to be done. 

D.  

cv_signal(cv pointer)

19:

What do the following mdb commands do?

::allocdby

::freedby

A.  

They are used to print the log of transactions on a particular memory location.

B.  

They are used to print the log of transactions by a particular thread. 

C.  

They are used to print the slab cache that refers to the particular address.

D.  

They are used to print the arenas that refer to the particular address.

20: Which of the following commands can be used to examine and delete kernel breakpoints?

A.   $b, :d

B.   ::break, ::delete

C.   $b, ::delete

D.   display break, delete break

21:

On a solaris system with no special kmem_flag settings,

what happens when a thread running buggy code frees a buffer twice.

A.  

The results are unpredictable including a panic.

B.  

The kernel fails the second kmem_free.

C.  

The kernel kills the thread with a SEGFAULT.

D.  

The second free is harmless as the kernel knows that the memory has already been freed.

22: Which of the following structures keeps track of the positional offset within the file where the next IO is to be performed?

A.   struct file

B.   struct vnode

C.   struct inode

D.   struct proc

23: Which of the following structures describes the user initiated IOs?

A.   struct buf

B.   struct file

C.   struct uio

D.   struct sio

24: Which of the following interfaces can be used by a driver interface routine to copy data from and to the user address space?

A.   memcpy

B.   bcopy

C.   copyin;copyout

D.   memmove

25: Which of the following abstractions is the fundamental schedulable entity on a solaris machine?

A.   User process.

B.   LWP.

C.   Kernel thread.

D.   Interrupt handler.

26: Which of the following adb/kadb commands can be used to determine the function which caused the panic?

A.   $

B.   panic address?ia

C.   $r

D.   $C

27: Solaris rw locks are recursive locks. A thread that already holds a lock in the read mode can acquire the lock in the read mode again.

A.   True

B.   False

28: Which of the following sets does a breakpoint at the start of the kernel function ufs_read?

A.   ufs_read:b

B.   ufs_read!break

C.   ::break ufs_read

D.   ufs_read>break

29: Which of the following sparc instructions forms the basis of all other locking strategies?

A.   lock

B.   ldstub

C.   movsb

D.   save

30: Can the mutex be locked by one kernel thread and unlocked by another kernel thread?

A.   Yes

B.   No

31: In which of the following driver interfaces should device instance specific resources be handled?

A.   _init; _fini

B.   open; close

C.   attach; detach

D.   probe

32: What is the outcome if an interrupt handler needs to block on a resource?

A.   The kernel will detect this situation and will panic the system.

B.   The system will hang.

C.   The interrupt handler will block until it can run again.

D.   None of the above.

33: Which of the following has the lowest scheduling latency?

A.   User thread.

B.   Kernel thread.

C.   User Process.

D.   LWP.

34: Which of the following commands can be used to examine the panic stack trace?

A.   $r

B.   $

C.   $C

D.   $

35: Which of the following sparc instructions is employed before returning from a function to restore the original context?

A.   restore

B.   pop

C.   revert

D.   ret

36: Which of the following kernel interfaces can be used by a driver interface like open to identify the specific device instance involved in the operation?

A.   getmajor(dev_t)

B.   getminor(dev_t)

C.   open

D.   ((dev_t) dev) & 0xFFFF0000;

37: The memory allocated by kmem_alloc is private to the kernel thread that allocated it.

A.   True

B.   False

38: Which of the following interfaces is the preferred way for drivers to log messages?

A.   printf

B.   cmn_err

C.   dmesg

D.   log

39: How many times can a semaphore be acquired without blocking?

A.   It depends on the count associated with the semaphore.

B.   1

C.   2

D.   0

40: Which of the following firmware commands causes a kernel core file to be dumped to the dump device?

A.   $sync

B.   sync

C.   dump

D.   $dump

41:

What does the following kernel interface do?

rw_lock_held(lock pointer);

A.  

It checks if the lock is held in the read mode.

B.  

It checks if the lock is held in the write mode.

C.  

It does 'a' and locks it in the write mode.

D.  

It does 'b' and locks it in the read mode.

42: Which of the following is true of the memory allocated by kmem_alloc?

A.   It is double word aligned.

B.   It is pageable.

C.   It is zero initialized.

D.   Its availability is limited to the amount of physical memory.

43: Which of the following information must be tracked explicitly by a driver that allocates memory via kmem_alloc?

A.   The address of the allocated memory.

B.   The size of the allocated memory.

C.   The alignment of the allocated memory.

D.   The thread that allocated the memory.

44: Which of the following interfaces does the OS call to translate path names to vnodes?

A.   VOP_LOOKUP

B.   VOP_READDIR

C.   VOP_GETPAGE

D.   VOP_READ

45: The condition variable synchronization primitives need which of the following primitives to be employed by the client code to function correctly?

A.   Reader-writer locks.

B.   Mutex

C.   Semaphore

D.   Spin lock

46: Which of the following kadb/adb commands prints the contents of the register set at a particular stack depth?

A.   $

B.   $C

C.   $r

D.   $b

47: If there is contention between readers and writers on an rw lock, which of them are given preference over the other?

A.   Readers

B.   Writers

C.   Neither (there is FCFS granting of locks).

D.   Both (there is one grant from either group).

48: Which of the following mechanisms enables solaris to support real time applications?

A.   Hidden scheduling.

B.   Priority inheritance.

C.   Priority inversion.

D.   Interrupts.

49: Is the glock necessary if a filesystem does not implement the mmap interface?

A.   Yes

B.   No

50: Is the thread allowed to perform any kind of blocking operation while holding a mutex?

A.   Yes

B.   No