Uploaded January 2015 | Updated November 2026, 3 hours ago
Demo the use of the fork() function in Linux/Unix to spawn a new process. Cover the basics of what it does, how to do work in parent and child processes, and how to correctly terminate. Full code can be found at github.com/drbfraser/video-tutorial-code/tree/master/fork_demo Topics list below. See later videos in this playlist for use of exec(), and fork() with exec().
Topics:
- Basics of fork and checking parent vs child
- Building via command line and GCC
- Structing code with a function to do work.
- Seeing processes via ps -a
- Demo having two separate address spaces
- Return a value from child to parent using exit() and wait()
- See zombie process
- See fork in a loop.
Demo the use of the fork() function in Linux/Unix to spawn a new process. Cover the basics of what it does, how to do work in parent and child processes, and how to correctly terminate. Full code can be found at github.com/drbfraser/video-tutorial-code/tree/master/fork_demo Topics list below. See later videos in this playlist for use of exec(), and fork() with exec().
Topics:
- Basics of fork and checking parent vs child
- Building via command line and GCC
- Structing code with a function to do work.
- Seeing processes via ps -a
- Demo having two separate address spaces
- Return a value from child to parent using exit() and wait()
- See zombie process
- See fork in a loop.


![Switching Activities in Android Studio: Android Programming
Create and launch a second Android activity. Covers Intent, startActivity(), finish(), and the activity stack.
For tutorial on creating a button, see https://www.youtube.com/watch?v=aE5f1tV5nU4
Initial setup:
Have project with initial activity and button for Toast
Create new activity: SecondActivity
Show .xml, .java, and manifest.
Launch activity:
startActivity(new Intent( [Current Activitys this], [New Activitys Java].class));
Encapsulate launching
Intent i = SecondClass.makeIntent(this)
startActivity();
Activity Stack
- Loading an Activity pushes it on the Activity *Stack*
- Pressing back button pops stack:
destroys this activity, returns to previous activity.
- New Button runs activitys finish() method pops it in code.
Must use correctly to have good activity stack.
If you instead startActivity() back to the first one, you make a loop.
Can move on and kill current activity:
startActivity(...);
finish();
Troubleshooting:
- Demonstrate what happens with the activity being in the manifest.
* View LogCat via DDMS:
...android.content.ActivityNotFoundException: Unable to find explicit activity class ...; have you declared this activity in your AndroidManifest.xml? Switching Activities in Android Studio: Android Programming](https://i.ytimg.com/vi/B1oaE0Odqes/mqdefault.jpg)







