URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       Class H22
  HTML https://classh22.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: Summeries
       *****************************************************
       #Post#: 41--------------------------------------------------
       switch context - summery
   DIR By: SpiderGoat
       Date: March 23, 2014, 3:20 am
       ---------------------------------------------------------
       this is what i've got from joel's lecture:
       instance of an executing problem.
       like a closed group that need to bring yield.
       variables belong to all, and not just the threads'.
       thread = task inside a process.
       in linox the process works.
       has its own registers, memory, and sometimes even the control.
       other processes can't manage with its own memory field.
       fork - a split.
       when it happens, the process' splits ask whether they are the
       father or the son, and both proceed as should.
       lets say, a program that creates several different output, like
       audio/video/subtitle/communication/two pages in word/another tab
       in chrom. a non-binar tree.
       all processes have their own address space.
       when segment runs out of space, the process copied to an other
       larger space.
       the reallocation starts only when process actually asks to
       continue;
       only full segment is reallocated. other segments stay in place.
       indepedant entity shielded with hardwear(space-budjet).
       in linux:
       4G
       ______
       |  OS      |
       |======|
       allocated and freed).
       |stack     |
       area.
       |______|
       |
       |
       |__^___ |
       |heap     |
       |======|
       |bss        |
       in tables in OS.
       |______|
       |DATA   |
       |======|
       |text        |
       |______|
       // from here it's partial bullshit... //
       context switch - father has cs, ds, ss, es (segments), addressed
       in 4 registers.
       moving to other father process is moving other adresses to
       registers to work on.
       change register that changes addresses.
       every process has 4 register - for 4 segments.
       the OS decides to free the register for another process.
       moving to other threads in a process won't move anything - it's
       all the process' area.
       needs both registers and data segments.
       the OS "saves" the image of the process' registers and work
       place in data segment of OS,
       and upload it when returning to it from another father using
       CPU.
       context - the work and the info on the registers.
       // EOB //
       
       program counter (PC) is last to be given to CPU, as it means
       loosing and passing on the control.
       in the moment PC is given next order is to step forward.
       PC points to next order. instruction pointer. is a register, and
       not located in one.
       all static go to code. same with strings.
       they sit together with the code.
       sp - 
       psw - 
       performs the function of a Status register and Program counter.
       Contained within the PSW are certainly the zero (non-zero) and
       carry (borrow) flags,
       of other architectures' status registers.
       pc - 
       indicates where a computer is in its program sequence.
       the PC is incremented after fetching an instruction, and holds
       the memory address of (“points to”) the next
       instruction that would be executed.
       &process->workingRegisters->pc = entryPoint;
       entryPoint - where in the memory the code starts.
       every thread has its own entryPoint.
       bp - 
       in the stack, typically above the local variables.
       process has memory, list of own threads, priority and state.
       the thread uses process's medium to "be".
       context - store CPU (working regs) and memory-Segment's
       registers, and apply new ones.
       the CONTEXT - the bunch of REGISTERS of that thread/process. the
       STATE of a process.
       A context switch can mean a register context switch, a task
       context switch, a stack frame switch, a thread context switch,
       or a process context switch.
       pcb - 
       structure. also called switchframe.
       the PCB for the first process must be created and saved.
       Since the operating system has effectively suspended the
       execution of the first process, it can now load the PCB and
       context of the second process. In doing so, the program counter
       from the PCB is loaded,
       and thus execution can continue in the new process. New
       processes are chosen from a queue or queues.
       Process and thread priority can influence which process
       continues execution,
       with processes of the highest priority checked first for ready
       threads to execute.
       *****************************************************
       Page 1 of 1