TATA Consultancy Services Interview Question


Country: India




Comment hidden because of low score. Click to expand.
0
of 0 vote

As I know difference for kernel with lwp and process - task_info structure for lwp. If this structure exists - it is lwp. For get less overhead kernel use mechanism as know as page fault. Restore context will be full (cpu registers).

- Stan P. March 25, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1.
Linux newbie...so, take this with a grain of salt. I looked into Linux source code and here is what I see. I looked into the source and then I understood Stan's comment. But, posting for ref.

55 struct thread_info {
 56         struct task_struct      *task;          /* main task structure */
 57         __u32                   flags;          /* low level flags */
 58         __u32                   status;         /* thread synchronous flags */
 59         __u32                   cpu;            /* current CPU */
 60         mm_segment_t            addr_limit;
 61         unsigned int            sig_on_uaccess_error:1;
 62         unsigned int            uaccess_err:1;  /* uaccess failed */
 63 };

If the task ptr in is not NULL, then it means that this is a thread. If NULL, it is a process.

- smallchallenges March 31, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Forgot the second part of the question....I posted a link to an ITANIUM programmers manual and the post got killed :-(

The thread context is usually lighter than the process context. Hence the speed difference.
For example, thread context is only the general purpose cpu registers. Floating point registers, memory management info (like region table info in Itanium), etc are not saved on a thread context switch...they *HAVE* to be saved if we were to switch processes and new ones restored. Look at any chipsets system programmer's manual for details.

- smallchallenges March 31, 2016 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More