Life Cycle of a Process [Operating System] Life Cycle of a ProcessGoal:- How a process changes its state while execution ?Explanation:- As we know a program in execution is a process.As a process executes it changes state. The state of the process is defined by the current activity of that process. Each process may be in one of the following states:- New Ready Running Waiting Terminated The above five states are standard states for a process in which a process remain in their life cycle.These states are found on all systems but there can be difference of naming conventions.Except of these states there are two more states which we will discuss in this post. They areSuspended Ready Suspended Wait. Figure-1 Shows the life cycle of a Process:- Figure-1 States of a Process Now we will start with description of each state:-New:- If the process is in new state that means either the process is under creation or is being created. Ready:- After the successful creation of a process, it is placed in Ready state by Long Term Scheduler. In this state process will wait to be assigned to a processor.In this state we can have a multiple no. of processes. Running:- From the Ready state one of the process is selected and it will be scheduled or Dispatched to the Running State by Short Term Scheduler. If a process is in Running state that means instructions of the process are being executed. ****Only one process will reside in memory(Running State) at any point of time. Waiting:- If any running process require any input/output operation the process will be moved into wait state. ** In wait state, multiple process are there. Multiple process will perform their I/O simultaneously. Terminated:- The Process has finished execution. Suspended Ready:- When the large no. of process are created and resources are short enough to manage the process then some of the process will be suspended and moved to suspended ready state. Whenever the resources are sufficient the process are resume back to the ready state by Mid term Scheduler. Suspended Wait:- When resources are short enough to manage the process in wait/block state then some of the process will be suspended and moved to suspended block state. Whenever the resources are sufficient the process are resume back to the wait state by MTS. -->**When the Process is in Suspended Ready or Suspended wait, it reside in secondary memory or Backing Store.So this is all about Life cycle of a process and if I really helped you please let me know via comment. If you want to share more information about topic discussed above or find anything incorrect Please do comments. For more Concepts Stay Connected..Like us on Facebook. Life Cycle of a Process [Operating System] Life Cycle of a Process Goal:- How a process changes its state while execution ? Explanation:- As we know a program in execution is a proces... + Read more »
How to do[Implement] Swipe in Android[In Eclipse] How to do Swipe in Android Goal:- Detecting swipe events in Android ? Explanation:- Android supports eight gestures and Swipe is one of them which is mostly used in apps. A swipe event generally occurs when you drag your hand on screen from one point to another.Sometimes Swipe is considered same as drag but there is some differences between them- 1. Swipe is faster than drag. 2. Drag stops affecting screen when you remove your finger from screen but in case of swipe it affect the screen even after the finger is removed. Without getting much in swipe's intro, i am starting with the actual thing for which you are here. To implement swipe in your app, you don't have to do much coding. Because Android provides you a GestureDetector class which detects all types of gesture. It supports the gestures like onDown(), onLongPress(), onFling() but swipe is handled by onFling(). Steps:- So here is the simple steps of implementing Swipe in your App:- Implement OnGestureListener() interface. Now you will see a warning sign in your eclipse, click on that and implement all abstract methods. Look for the function named onFling(). onFling() function accept four arguments in which first two are of Motion type and Last two are of float type. first and second argument represent the first(when you first touch the screen) and last(when you release the screen) touch events (position, pressure, size, addition of another finger, etc.) respectively. Last two arguments represents the velocities along X-axis and Y-axis respectively. You also need to create a object of GestureDetector to get information about the gesture happened. Program:- Output:- I don't think that there is a need of uploading the output of this program.When you run this app there is blank screen because we didn't add any component in layout file. When you swipe the screen then there will be a toast message specifying the type of your swipe. *In the toast message Toast.LENGTH_LONG is used so you need to wait for next toast message. *If you face any problem in implementing this code ,tell me via comments. * If you need any program or any help in programming then Request Here If you want to share more information about topic discussed above or find anything incorrect Please do comments. For more Programs Stay Connected..Like us on Facebook. How to do[Implement] Swipe in Android[In Eclipse] How to do Swipe in Android Goal:- Detecting swipe events in Android ? Explanation:- Android supports eight gestures and Swipe is o... + Read more »