AndroidProgramming8LectureMulti-threading
Android Programming Lecture 8 Multi-threading
TimesharingOperatingSystems All modern operating systems are capable ofsharing processor(s) between multiple users andprocesseso Process scheduling algorithmsThere are often lots (hundreds) of processesrunningo Many are managed by the systemOfficeoSomeareuserexecuted?A福Adobe
Timesharing Operating Systems • All modern operating systems are capable of sharing processor(s) between multiple users and processes o Process scheduling algorithms • There are often lots (hundreds) of processes running o Many are managed by the system o Some are user executed 2
ProcessAprocess is typically defined as execution of a singleprogram on a computing deviceo ProcessesarescheduledbytheOsoProcessesareownedbyauserortheOs (root)o Processes may have a long lifetime (a web server) or a shortlifetime (onerunofashortprogram)oProcessesdonotsharememorybetweeneachothero MostOSsupportinter-processcommunicationofficeAAdobe3
Process • A process is typically defined as execution of a single program on a computing device o Processes are scheduled by the OS o Processes are owned by a user or the OS (root) o Processes may have a long lifetime (a web server) or a short lifetime (one run of a short program) o Processes do not share memory between each other o Most OS support inter-process communication 3
Threads. A thread is a component of a processo Usually considered the smallest unit that can bescheduled by an OSo Can share memory and instructions with otherthreads in the same processo Most OS support inter-thread communication
Threads • A thread is a component of a process o Usually considered the smallest unit that can be scheduled by an OS o Can share memory and instructions with other threads in the same process o Most OS support inter-thread communication 4
Process V.S.ThreadDifferenca setween Process+radOne ltread of ConholPyojrantveaSeCondofControl5
Process V.S. Thread 5