Table of Contents

Part 2

Entries

Entry 1: October 10, 2012

Entry 2: October 31, 2012

Entry 3: October 19, 2012

Entry 4: October 17, 2012

Keywords

data Keyword 2

queue overrun condition

Definition

Queue Overrun/Overflow Condition happens when a program attempts to add an element onto an already filled queue.

References

data Keyword 2 Phase 2

stack (LIFO or FIFO?)

Definition

LIFO is an acronym that stands for “Last In, First Out.” When it comes to stacks, functions and procedures that are running become stacked on top of one another in memory (called a “push”). When an item is removed from the stack (or “popped”), it is removed from the top down. This computing action allows for stack integrity, and limits access/insertion.

FIFO means “First In, First Out.” In this regard, data and processing are handled on a first come, first serve basis through usage of a queue (or linear data structure). The first process in line is handled before any others are, and then the next, and so on.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

Demonstration

  • To put another node on top of the stack, you “push” the node onto the top of the stack and becomes the top of the stack (obviously).
  • To pull nodes from the top of the stack, you “pop” the top node off of the stack.

LIFO STACK (Last In, First Out)

(The number represents the order in which they were put into the list)

( 6 ) TOP (This would be the first one out, being the last one input, because it is on the top of the list)
  ^
  |
( 5 ) 
  ^
  |
( 4 
  ^
  |
( 3 )
  ^
  | 
( 2 )
  ^
  |
( 1 ) BOTTOM (This would be the last one out, although it was the first one input)

FIFO STACK (First In, First Out)

(The number, just like above, represents the order)

( 1 ) TOP (This would be the first one out)
  ^
  |
( 2 ) 
  ^
  |
( 3 )
  ^
  |
( 4 )
  ^
  |
( 5 )
  ^
  |
( 6 ) BOTTOM (This would be the last one out)

discrete Keyword 2

cartesian product

Definition

Cartesian Product is making one set that takes one from a set and pairs it with one value from another set. This is done for each of the values in each set. Example:

  • {1, 2} * {up, down} = {(1, up), (1, down), (2, up), (2, down)}
  • {1, 2, left} * {left, right, up, down} = {(1, left), (1, right), (1, up), (1, down), (2, left), (2, right), (2, up), (2, down), (left, left), (left, right), (left, up), (left, down)}

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • Reference 1
  • Reference 2
  • Reference 3

discrete Keyword 2 Phase 2

variables (environment/local)

Definition

A local variable is only known in the function that you created it in. It isn't known in any other functions and can't be used in any other function. Each time you use the function is starts at whatever value you assigned it to. Global variables are known and can be used by any function in the program. So if you make a variable outside of main() it is a global variable because it can be used in any function. If you make a variable inside main() it can only be used in main() so it is a local variable.

References

Demonstration

  1 #include <stdio.h>
  2 
  3 int glovar = 20; // Global Variable
  4 
  5 int local( int );
  6 
  7 int main()
  8 {
  9     int localvarmain = 0;
 10 
 11     printf("global variable: %d\n\n", glovar);
 12     printf("Local variable cannot be demonstrated the same way because if the program tries\n");
 13     printf("to access a variable that doesn't exist, the program will not compile correctly\n");
 14     printf("and result in the program not running correctly\n\n");
 15 
 16 // Running local function to add the local variable (to the function) to the global variable
 17 
 18     glovar = local( glovar );
 19 
 20     printf("New global variable: %d\n", glovar);
 21 
 22     return 0;
 23 }
 24 
 25 int local( int glovar )
 26 {
 27     int localvar = 10;
 28 
 29     glovar = glovar + localvar;
 30     return glovar;
 31 }

The printed result:

lab46:~/src/opus/opus2$ ./unixdemo 
global variable: 20

Local variable cannot be demonstrated the same way because if the program tries
to access a variable that doesn't exist, the program will not compile correctly
and result in the program not running correctly

New global variable: 30

unix Keyword 2

shabang

Definition

A shabang is this: #! The shabang is used to read the following test on the first line after it to determine what interpreter the user would like to… use. Some example of interpreters (Taken directly from http://en.wikipedia.org/wiki/Shebang_(Unix):

  • #!/bin/bash – Execute the file using sh, the Bourne shell, or a compatible shell
  • #!/bin/csh – Execute the file using csh, the C shell, or a compatible shell
  • #!/usr/bin/perl -T – Execute using Perl with the option for taint checks
  • #!/usr/bin/php – Execute the file using the PHP command line interpreter
  • #!/usr/bin/python -0 – Execute using Python with optimizations to code
  • #!/usr/bin/ruby – Execute using Ruby

References

unix Keyword 2 Phase 2

PATH environment variable

Definition

The $PATH variable specifies a list of one or more directory names separated by colons.

The /bin, /usr, and /local directories are typically included in most users' $PATH settings. The current directory is sometimes included, allowing programs in the current directory to be executed. Superuser (root) accounts as a rule are not include in $PATH, however, in order to prevent the accidental execution of scripts in the current directory.

When a command name is specified by the user or an exec call is made from a program, the system searches through $PATH, examining each directory from left to right in the list, looking for a filename that matches the command name. Once found, the program is executed as a child process of the command shell or program that issued the command.

References

Demonstration

The following is an example of a $PATH:

lab46:~/src/opus/opus2$  

The $PATH The home directory (~/) is the beginning of this specified $PATH, followed by the src directory, then the opus directory, and lastly the opus2 directory.

Experiment 2

Question

I downloaded VirtualBox and Debian to run on it, but when everything was installed, the possible resolutions were not available to me. I am going to experiment with it and figure out how to fix it.

Resources

I installed it with the help of Evan Olson, but the rest of my help will come from the internet and whatever I can find. Any websites used will be listed below:

Hypothesis

I believe that I will need to install packages for the resolution. I don't think there will be much more to it, maybe some command line arguments to actually use the packages or something along those lines.

Experiment/Data

I will research VirtualBox and Debian and find how to fix the problems. I will document my research and experiment in the data section below with the use of screenshots and such!

Well, the first problem I ran into was that I wasn't a sudo user, so with your help, I made myself one by going to the terminal, going to the root command prompt, accessing the visudo file, and adding myself as a user. From there, I typed in sudo apt-get install virtualbox-ose-guest-x11, which, I think, installed the Guest Addition Driver X11. I ended up getting a larger resolution (1024 x 768) instead of the monitor's natural resolution (1600 x 900). I tried the other website's tactics, which were to update Debian, remove the OSE guest additions using sudo apt-get remove virtualbox-ose-guest* and then mounted the VBOXADDITIONS ISO by using the command sudo sh /media/cdrom/VBoxLinuxAdditions.run.

Analysis

Based on the data collected:

Conclusions

I can conclude that I have an extremely hard time messing around with operating systems and it is a lot harder than I thought it would be.