Basic CS-Operating System [3i Infotech Placement]: Sample Questions 29 - 30 of 89

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 29

Operating System



The command “grep first second third/usr/you/myfile”


Choice (4)


prints lines containing the words first, second or third from the file/usr/you/myfile


searches for lines containing the pattern first in the files second, third, and/usr/you/myfile and prints them


replaces the word first with the word second in the files third and/usr/you/myfile


searches the files/usr/you/myfile and third for lines containing the words first or second and prints




  • The command grep first second third/usr/you/myfile searches for lines containing the pattern first in the files second, third, and/usr/you/myfile and prints them.
  • The grep searches a file for a particular pattern of characters and displays all lines that contain that pattern.
  • The pattern searched in the file is referred as the regular expression.
  • Output line longer than terminal width wraps around to the following lines, but this output corresponds to exactly one line in FILE.


grep [optionas] pattern [files]

grep [options] [-e pattern |-f file] [file … .]

Question 30

Operating System

Describe in Detail


What are the possible states a thread can have?


A thread can be in one of the following states:

Define Thread State
  • Ready:
    • Waiting to execute.
    • Dispatcher considers only the pool of threads in ready state.
  • Standby:
    • Select to run next on a particular processor.
    • When correct condition exists, the dispatcher performs a context switch to the new thread.
    • Only one thread is in standby state for the processor on the system.
  • Running:
    • Dispatcher performs a context switch to a thread.
    • Thread enters the running state and executes.
    • Pre-empted a higher priority thread.
  • Waiting:
    • Thread waits for some IO, or synchronize event.
    • Thread can wait on environment subsystem or OS can direct the thread to suspend itself.
    • If the waiting event happens, depending on the priority, the waiting thread moves back to the ready state.
  • Transition:
    • A thread enters the transition state when it is ready for execution but kernel stack is paged out of memory.
    • When kernel stack is brought into memory, the thread enters the ready state.
  • Terminated:
    • When a thread finishes executing, it enters the terminated state.

Developed by: