Basic CS-Operating System [TCS Placement]: Sample Questions 18 - 19 of 35

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 18

Operating System
Edit

Describe in Detail

Essay▾

Describe the Buddy system of memory allocation

Explanation

  • The buddy memory allocation technique is a memory allocation algorithm that devices memory into partitions to try to satisfy a memory request as suitably as possible.
  • This system makes use of splitting memory into halves to try to give a best-fit
  • Compared to the more complex memory allocation techniques that some modern operating systems use, buddy memory allocation is relatively easy to implement.
  • It supports limited but efficient splitting and coalescing of memory blocks.
  • Free memory is maintained in linked lists, each of equal sized blocks.
  • Any such block is of size .
  • When some memory is required by a process, the block size of next higher order is chosen, and broken into two.
  • Note that the two such pieces differ in address only in their bit. Such pieces are called buddies.
  • When any used block is freed, the OS checks to see if its buddy is also free.
  • If so, it is rejoined, and put into the original free-block linked-list.
Given the Image is Define the Buddy System Example

Question 19

Operating System
Edit

Describe in Detail

Essay▾

What is time-stamping?

Explanation

  • A timestamp is the current time of an event that is recorded by a computer.
  • It is a technique proposed by Lamport, used to order events in a distributed system without the use of clocks.
  • This scheme is intended to order events consisting of the transmission of messages.
  • Through mechanisms such as the Network Time Protocol (NTP) , a computer maintains accurate current time, calibrated to minute fractions of a second.
  • Such precision makes it possible for networked computers and applications to communicate effectively.
  • The timestamp mechanism is used for a wide variety of synchronization purposes, such as assigning a sequence order for a multi-event transaction so that if a failure occurs the transaction can be voided.
  • Another way that a timestamp is used is to record time in relation to a particular starting point. In IP telephony.
  • Example: the Real-time Transport Protocol assigns sequential timestamps to voice packets so that they can be buffered by the receiver, reassembled, and delivered without error.
  • When writing a program, the programmer is usually provided an application program interface for a timestamp that the operating system can provide during program execution.
  • Each system ‘i’ in the network maintains a counter Ci.
  • Every time a system transmits a message, it increments its counter by 1 and attaches the time-stamp Ti to the message.
  • When a message is received, the receiving system ‘j’ sets its counter Cj to 1 more than the maximum of its current value and the incoming time-stamp Ti.
  • At each site, the ordering of messages is determined by the following rules: For messages x from site i and y from site j, x precedes y if one of the following conditions holds
    1. if Ti < Tj or
    2. if Ti = Tj and i < j.
Given the Image is Define the Timestamp Concurrency Control Protocols

Developed by: