You are on page 1of 4

01. Describe the difference between a Thread and a Process?

A process is a collection of virtual memory space, code, data, and syste m resources. A thread is code that is to be serially executed within a process. A processor executes threads, not processes, so each application has at least on e process, and a process always has at least one thread of execution, known as t he primary thread. A process can have multiple threads in addition to the primar y thread Thread is stream of executable code within process. They are light weigh t process. All thread with in a process share process instruction,code & data segme nt,open file descriptor,signal handler,userID and GroupID. Thread has its own se t of register including program counter,stack pointer The major difference between threads and processes is 1.Threads(Light weight Processes) share the address space of the process that created it; processes have their own address.2.Threads have direct access to the data segment of its process; processes have their own copy of the data se gment of the parent process. 3.Threads can directly communicate with other threa ds of its process; processes must use interprocess communication to communicate with sibling processes. 4.Threads have almost no overhead; processes have consid erable overhead.5.New threads are easily created; new processes require duplicat ion of the parent process.6.Threads can exercise considerable control over threa ds of the same process; processes can only exercise control over child processes . 7.Changes to the main thread (cancellation, priority change, etc.) may affect the behavior of the other threads of the process; changes to the parent process does not affect child processes.If we consider running a word processing program to be a process, then the auto-save and spell check features that occur in the background are different threads of that process which are all operating on the same data set (your document). 02. What is a Windows Service and how does its lifecycle differ from a standard EXE? Answer A service opens before you even get to the login screen, whereas a stand ard exe cannot open until after you have logged on. Answer Windows Service applications are long-running applications that are idea l for use in server environments. The applications do not have a user interface or produce any visual output. Any user messages are typically written to the Win dows Event Log. Services can be automatically started when the computer is boote d. They do not require a logged in user in order to execute and can run under th e context of any user including the system. Windows Services are controlled thro ugh the Service Control Manager where they can be stopped, paused, and started a s needed. Answer Windows service is a application that runs in the background. It is equi valent to a NT service. The executable created is not a Windows application, and hence you can't just click and run it . it needs to be installed as a service, VB.Net has a fac ility where we can add an installer to our program and then use a utility to ins tall the service. Where as this is not the case with standard exe 03. What is the maximum amount of memory any single process on Windows can addre ss? Is this different than the maximum virtual memory for the system? How would this affect a system design? Answer Processes access virtual memory space, not physical memory. Applications never access RAM directly but only through the memory management interface of t

he processor. Depending on which version of Windows you are using, and how the program was compiled there is a different maximum ammount of addressable memory. All 32 bit processes on 32bit Windows have a 4GB virtual address space. The upper 2GB is common to all processes and is used by the system. The lower 2G B is private to each process and is inaccessable to all others. Unless the progr am was compiled as large address aware, in which case it will have 3GB of privat e address space. For 32bit processes on 64bit Windows, each process has 2GB private addre ss space, unless compiled large address aware in which case it has 4GB private a ddress space. For 64bit processes on 64bit windows each process has 8TB of private add ress space whilst compiled as large address aware. The 2GB address space limit r emains for programs not compiled as large address aware. This is completely independent of the size of RAM or the pagefile. The s ystem maps physical memory into this virtual address space according to both nee d and availability. At any given time the data in virtual memory space might be stored in RA M, on disk, or both. All of this is totally transparent to all applications. Fre quently accessed data will be kept in RAM with the remainder left on disk. Actually processes access virtual memory space, not physical memory. Applications never access RAM directly but only through the memory management interface of the processor. All processes have a 4GB virtual address space. The upper 2GB is common to all processes and is used by the system. The lower 2GB is private to each process and is inaccessible to all others. This is completely independent of the size of RAM or the page file. The system maps physical memory into this virtual address space according to both need and availability. At any given time the data in virtual memory space might be stored in RAM, on disk, or both. All of this is totally transparent to all applications. Frequently accessed data will be kept in RAM with the remainder left on disk. 04. What is the difference between an EXE and a DLL? EXE file has Entry point, but in dll no Entry point. EXE file is a excutable file which runs in a seperate process which is managed by OS,where as a DLL file is a dynamic link library which can be used in exe files and other dll files. In .net frame work both are assemblies. a) In shortcut .exe is an executable file & DLL (Dynamic Link Library) i s not an executable file. b) DLL is an in-process server while exe is a out-process server it mean s DLL works within the thread of application, while exe works after creating its own thread. c) If DLL fails the application became fail if exe fails DLL doesn't fai l because it's not work within the thread of application but the part of the exe could not work properly. d) An EXE is visible to the system as a regular Win32 executable. Its en try point refers to a small loader, which initializes the .NET runtime and tells it to load and execute the assembly contained in the EXE. A DLL is visible to t he system as a Win32 DLL but most likely without any entry points. The .NET runt ime stores information about the contained assembly in its own header. 05. What is strong-typing versus weak-typing? Which is preferred? Why?

Strong type is checking the types of variables as soon as possible, usua lly at compile time. While weak typing is delaying checking the types of the sys tem as late as possible, usually to run-time. Which is preferred depends on what you want. For scripts & quick stuff you ll usually want weak typing, because you want to write as much less code as possible. In big programs, strong typing can reduce errors at compile time. 06. What's wrong with a line like this? DateTime.Parse(myString Parse converts date at any cost. What if user passes date in format MM/d d/yyyy whereas you are expecting in dd/MM/yyyy.Assume the user is passing 12/09/ 2006 meaning Dec 12, 2006, whereas Parse (based on the current locale) picked it up as Sep 12, 2006. The result is not something which you would like. Also Pars e takes more time compared to other as it has to check for a gazillion formats. Instead if you know the format its better to go with ParseExact. Then why the he ll do we have Parse? May be for the old VB customers it was an easier transition . Nothing wrong with the format really. Only problem is that the result would depend on the Culture of the machine where this line is getting invoked. Ideally you should also supply the second parameter - or specify the Culture! 07. What are PDBs? Where must they be located for debugging to work? A Program DataBase file (extension .pdb) is a binary file that contains type and symbolic debugging information gathered over the course of compiling an d linking the project. A PDB file is created when you compile a C/C++ program wi th /ZI or /Zi or a Visual Basic, Visual C#, or JScript program with the /debug o ption. The Visual Studio debugger uses the path to the PDB in the EXE or DLL fil e to find the project.pdb file. If the debugger cannot find the PDB file at that location, or if the path is invalid, for example, if the project was moved to a nother computer, the debugger searches the path containing the EXE followed by t he symbol paths specified in the Options dialog box (Solution Properties-->Debug Symbol Files node in VS.NET 2003). The debugger will not load a PDB that does n ot match the binary being debugged. 08. What is cyclomatic complexity and why is it important? Cyclomatic complexity is a computer science metric (measurement) develop ed by Thomas McCabe used to generally measure the complexity of a program. It di rectly measures the number of linearly independent paths through a programs sour ce code. The concept, although not the method, is somewhat similar to that of gen eral text complexity measured by the Flesch-Kincaid Readability Test. Cyclomatic complexity is computed using a graph that describes the contr ol flow of the program. The nodes of the graph correspond to the commands of a p rogram. A directed edge connects two nodes, if the second command might be execu ted immediately after the first command. By definition, CC = E - N + P where CC = cyclomatic complexity E = the number of edges of the graph N = the number of nodes of the graph P = the number of connected components 09. Write a standard lock() plus double check to create a critical section aroun d a variable access. 10. What is FullTrust? Do GAC ed assemblies have FullTrust? 11. What benefit does your code receive if you decorate it with attributes deman ding specific Security permissions?

12. What does this do? gacutil /l find /i about 13. What does this do? sn -t foo.dll 14. What ports must be open for DCOM over a firewall? What is the purpose of Por t 135? 15. Contrast OOP and SOA. What are tenets of each 16. How does the XmlSerializer work? What ACL permissions does a process using i t require? 17. Why is catch(Exception) almost always a bad idea? 18. What is the difference between Debug.Write and Trace.Write? When should each be used? 19. What is the difference between a Debug and Release build? Is there a signifi cant speed difference? Why or why not? 20. Does JITting occur per-assembly or per-method? How does this affect the work ing set? 21. Contrast the use of an abstract base class against an interface? 22. What is the difference between a.Equals(b) and a == b? 23. In the context of a comparison, what is object identity versus object equiva lence? 24. How would one do a deep copy in .NET? 25. Explain current thinking around IClonable. 26. What is boxing? 27. Is string a value type or a reference type?

You might also like