Tuesday, December 14, 2021

CPT307 - Week 1 - Interactive Activity 2

 Hello everyone,


This week, I will be discussing how to install Java and Netbeans IDE and discussing the main concepts and features of Object-Oriented Programming (OOP).


JDK/NetBeans Guidance

To initially start, we are going to install Java (JDK) we are going to visit this website - Java (JDK) from this link we will choose which operating system we would like to install the Java on, in this case, we are going to be working with Windows, from there we select whichever bit version of Windows the user is running. In my personal case, x64 bit, then click on one of the various links provided, I find it easier to just use the installer which is 152MB. Once downloaded, open the executable and follow the visual prompts from the installer. Once completed to verify if the Java has been correctly installed we will open up our command prompt through either Windows key then run then type in CMD or hit the Windows key then type "command prompt", a black window will open up. 

From here in the command prompt, we will type this command, Javac -version. If installed correctly you will receive a message confirming which version of Java you have installed. See the image below.

If you did not receive the correct prompt above, try and reinstall the Java process, and or restart the computer, sometimes this can fix the issue. Now that we have successfully installed Java, we need to get the NetBeans IDE. From the following link we can download the installer - Netbeans IDE as of the current state of NetBeans IDE, it appears the current update is 12.6. So please begin to download then install the software following the visual prompts. We can open the NetBeans IDE application at this point after successfully updating and installing the program. Now that all the necessary functions have been established we will want to visit this link to the NetBeans IDE quick start guide here - Quickstart this will be the best resource to help create our first application "Hello World!" this will help establish a more current up-to-date guide on simpler ways to help identify some of the different functionalities that are within the NetBeans 12.6 environment.

Object-Oriented Programming Concepts

Object-Oriented Programming (OOP) is the methodology to design a program that uses objects and classes. Essentially, objects are entities that have two key factors, these factors are states and behaviors. States in objects are mainly the idea of descriptions of an entity, for example, a lamp, the state description, the base of it, the height, perhaps brightness levels, then the behaviors would be is it on or off.  Then moving onto what a collection of objects are which are classes, these essentially are blueprints from which objects are created. Then from objects, there is the concept of inheritance where an object has all the same attributes as a parent object, thus leading into the polymorphism concept where a task can be run in different ways. Those are just some of the key factors towards Object-Oriented Programming, but why would anyone use this form of programming for Java? Object-Oriented Programming helps make the development and maintenance of a project easier when projects grow in size. Object-Oriented Programming also helps by providing the functionality to hide critical data within the program. Following this resource will help anyone new to the Java language get a better understanding of how Object-Oriented Programming works and how we will be able to use this to better our skills. Link to resource - Object-Oriented Programming

Saturday, December 11, 2021

CPT304: Week 5 Project

 

   Operating Systems
Brandon Fillian
CPT304: Operating Systems Theory & Design
Bret Konsavage
December 13, 2021

             

Operating Systems

Section 1 – Major Functions of an Operating System

Operating Systems (OS) essentially are a way for an end-user to interface with a computer’s software and hardware. The key function of the operating system is to allow applications to be performed using the computer systems hardware to align with the programs being executed, this is done through processing, through the central processing unit (CPU). There are a total of nine key concepts that make up an operating system they are as followed, Error detection, protection and security, accounting, resource allocation, communication, file systems, I/O operations, program execution, and user interface. These eight concepts can be brought together to form five major functionality groupings that will be discussed throughout this paper alongside with illustrative diagrams to help create a better understanding of how these functions interact amongst themselves.

The ideal concept of an operating system is to help manage the end-user experience to ensure the user is able to operate the system with ease-of-use. To do this, the operating system is made up of several components, as mentioned previously, six of these key features are to make the use of the operating system easier for the end-user while the other three consist of ensuring that the computer runs efficiently. The six following functions; program execution, I/O operations, user interface, file system manipulation, error detections, and communications are to help the end-user establish an ease-of-use environment. Initially for an end-user to establish any sort of communication between them and the computer itself, there needs to be some sort of user interface or some form of command line, an example of a user interface would be the Windows operating system environment. Once an end-user has access to this interface, there needs to be an input of some sort, this is done through I/O operations, which allow the user to interact with the user interface to send different operations towards the CPU for execution. Found within the operating system user interface are file system manipulation toolkits. What these do are to allow the user access to files in memory to be read, written, moved, deleted, and other accessing abilities. The error detection functionality of an operating system is to detect errors when they arise and correct them before any form of issue occurs. Lastly, out of the six functions of the operating system there is communications. Communications in an operating system offer processes to managed shared data. The last three functions are to help the computer system’s efficiency. Resource allocations are to make sure that processes running are not overusing the system’s resources as an example memory. The protection and security function helps prevent any unwanted or malicious activity to occur on the system. Lastly the last function of operating systems is accounting which keeps track of the user’s activity.


Diagram of Major Functions of Operating Systems

 

 Section 2 – Processes and Synchronization

            Processes are units of work that are considered user programs or tasks that are executed within an operating system (Silberschatz et al, 2014). In other words, when a user opens an application a process an operation, or task is created and executed, this directly is forwarded through the operating system of a computer. Process states are the stages in which a process is currently at; referencing the five different process states new, running, waiting, ready, and terminated (Silberschatz et al, 2014). What process states are signified how a program or task is created and ends, an example starting an application creates the new process in an operating system. Running depicts the moment between the application start and where the process is going, in other words towards the CPU for processing, waiting is when the operation is waiting for an event to occur. Ready is when the CPU has decided where the process will be handled whether it be an application or some sort of mathematical algorithm that needs processing. Terminated means that the task has been completed or has failed to launch and ended the process before the entire process has been completed, this could be because of a fault in hardware or software, or the task was interrupted by the user themselves. The process control block or (PCB) is a process representation with different pieces of information of a specific process; process states, process numbers, program counters, registers, memory limits, list of open files, … (Silberschatz et al, 2014). The diagram below

 

Diagram of Process States and Process Control Block



    Processes have a special significance to them, each process consists of threads, threads consist of code, data, and files, with that each thread contains stacks and registers, there are two types of processes there are single-threaded processes and then there are multi-threaded processes. The single-threaded processes are processes that operates on its own, with its own singular control, whereas the multi-threaded processes have multiple threads of control. What a multi-threaded process is capable of doing is having the ability to run multiple operations in parallel, also known as parallelism (Patterson & Hennessy, 2014). Below are diagrams of a single-threaded process and a multi-threaded process.

 

Diagram of Single-Thread Process and Multi-Threaded Process


  

 

    Due to the nature of how processes are established, sharing of the same variable between two different processes can be an issue, this is what a critical-section problem is. The critical-section problem is when programs enter a state in which other processes cannot execute, meaning this operation is not parallel towards other processes. This state of a process is actually a segment of a code that allows shared variables to be accessed, however, only one process is allowed to execute into its critical section at any given time, in which all other processes need to wait for this process to exit its critical section before those processes are able to reach their critical section. Following Peterson’s solution of having two processes require two data items it allows for alternating execution between the processes critical sections by creating a variable flag[i] = true then creating a variable turn = j using a while statement flag[j] turn == j in the same statement will make flag[i] false, as the remainder of this section of code stays true. However by doing this, it does allow both i and j to become turn at the same time, however, only one of these set variables will last whereas the other will be overwritten instantly (Silberschatz et al, 2014). By following these assumed algorithms mutual exclusion is preserved, progress requirements are satisfied, and the bound-waiting requirement has been met because Process i can only enter its critical section if flag[j] == false or turn == i. To represent this coding, to make this solution accurate, the Pi process is prevented from entering its critical section if it becomes stuck in a while loop command with the condition of flag[j] == true and turn == j at that point Pi process can then enter its critical section. If process j is not ready to enter its critical section, then flag[j] has to be false then process i may enter its critical section (Silberschatz et al, 2014). With that said, Process j must rest flag[j] to a true statement which would also set turn to i and since process i does not change the value of the variable turn when executing the while statement process i will enter its critical section which progress occurs then “after at most one entry by process i (bound waiting)” (Silberschatz et al, 2014). In much simpler wording, this is the process of alternating between processes that share the same variable and multiple processes are trying to access variables.

Section 3 – Memory Management in Operating Systems

            Previously mentioned, memory management takes an important role in assisting with computer efficiency. Memory management systems are found within operating systems so that programs that are executed have their own process memory space for full functionality. The sizes of processes are limited to the size of physical memory that the computer has. The system needs to load these new processes when created into a base register also known as the relocation register. According to Silberschatz et al (2014), “the value in the relocation register is added to every address generated by a user process at the time the address is sent to memory” (Section 7.1.3). To understand this better, Silberschatz et al (2014) uses an example of a base relocation register as 14000 then proceeds to add a new process with the logical address of 346, this process moves towards the base relocation register to find the process a new memory location, to do this the 346 address is added to the base register of 14000 this making the physical address 14346 (Section 7.1.3). By placing the process into a physical memory location, it becomes understood that all programs need to be stored in the physical memory for a process to execute.

Diagram to express Virtual Address translation to Physical Address


                          Once the addresses have been created for the processes, the process is then stored within memory. There are several different types of memory that are found within a computer system, this is known as the memory hierarchy. The memory hierarchy is the concept of separating an entire computer’s storage system into different levels based upon their storage capacity and performance. The memory hierarchy is notable for being a pyramid based concept map, starting with registers as the highest level of the pyramid, this is where the CPU has the closest interaction with a storage location, generally, this is where the computing of processing starts, information is stored within registers for a short time, then this information is generally stored in the cache, this is generally where memory goes that would be volatile, generally speaking, user-processes created from executions, application executions found in main memory when executed would place the process in the cache. Following the figure below we can view the entire memory hierarchy.

Diagram of Memory Hierarchy




Section 4 – I/O Operations and Mass Storage

Throughout a computer system, there has to be a form of file system management, this topic can be separated into three sections: mass storage, user and programmer interfacing,  and internal data structures and algorithms. The algorithms for computing are done within the processor using the Arithmetic Logic Unit (ALU), the information is transferred back and forth using the address bus. Mass storage is how a user has the ability to access the information that is stored within a computer system, the operating system allows for a user to functionally move different file types throughout the system, however, these files are only allowed to be moved within the properties of the main memory locations. Main memory locations are known as flash disk, traditional disk, however, there are other forms of memory locations that operating systems allow access to that are considered secondary memory locations; remote storage locations (cloud/network-based), and external I/O bus (external disk drives).

The file-system interface is where users and programmers are able to view and have access to the data and programs of operating systems. File systems are notable for having two sections, collection of files, storing related data, and a directory structure (Silberschatz et al, 2014). This stored information is known as a file, files are physical property abstracts from an operating system that are stored as a logical storage unit. These files are stored on nonvolatile storage devices like hard drives. Files are also known as a sequence of bits, bytes, lines, or records defined by the file’s creator or user (Silberschatz et al, 2014). The file-system interface within operating systems allows for creating, reading, repositioning, deleting, truncating, and executing files. The file-system interface in the operating system allows for a large variety of file extensions to be executed.

File system management also contributes to the support of I/O functionality, allowing for external storage devices to be managed with a computer system. This function also helps allow multiple users, access the functions of the same I/O devices connected to a system, producing the same functional operations conducted with the I/O device, mouse clicks, keyboard ticks, external storage devices, etc. I/O external storage devices can also help prevent data loss if a computer system needs to be reformatted and have all stored information completely wiped clean, these devices allow for access backups if a backup cannot be accessed or created within the computer’s operating system. These devices are quite reliable in terms of allowing for quick access for data transfers from one system to another, and reliable backup storage locations that can be used to reformat a system’s operating system through the motherboard’s bios. Helps reduce the risk of a total failure to a computer system by having the operating system backup on an external drive, these backups could be read as an ISO extension file allowing for an entire operating system to be re-written to factory settings or other customizable functions if the ISO file has been developed for such use.

            Directory structures are to help organize folders and files, these types of structures are commonly known as; single-level directories, two-level directories, tree-structured directories, acyclic-graph directories, and general graph directories. To help understand what these structures are and how they function are exactly how their names are stated. Single-level directories are where all the files are located in the same directory but are limited to a single user, which indicates that each file must use a unique name. Two-level directories are where each user of a computer can create their own directories within the operating system, allowing for searching for files and folders much easier. These directories allow for shared location use because the files and folders can be indexed through the user entries. Tree-structured directors are notable for having a height of two levels but proceed to have the option of extending the structure through branches, the structure itself allows for subdirectories to be created and provides full pathing names, however, files can end up in multiple directories which can be difficult to locate the files. The acyclic directory has the ability to allow directories to share subdirectories and files. However, with that said these files and subdirectories are not exact copies if a change was made to one file or subdirectory this change will not have taken place in the other directory even if the file is the same. Lastly, the general-graph directory structure allows for cycles to occur and have the ability to have multiple directories created from more than one parent directory. Below is a diagram of the most commonly found directory in computer systems helps manage the locations of information.

Diagram of Tree-Structured Directory

    Lastly, the last major concept to operating systems, security, and protection. There are many different forms of threats that may impact a user experience and or be destructive towards the computer system. There are multiple different ways that a user and the operating system can utilize software and hardware to protect themselves and their system. One topic that is very meaningful in terms of protection are domains and access rights. The overall goal for domains is to specify resources that a process may need for access. Realistically, “domains are a collection of access rights, each of which is an ordered pair <object-name, rights-set>” (Silberschatz et al, 2014). To better understand what domains do, we can look at a Domain X that has access rights to a file x, the rights are to read, write, and execute, with these access rights on this domain, a process that is executed within this domain will have the access to read, write, and execute files, however, if the domain’s access rights are only these three then processes that are executed within this domain will only have these three rights and cannot perform other access rights. Meanwhile, because there are multiple domains to a system, each domain with its own different set of access rights for processes, there will be a case where domains may need to share access rights, and for that, this opportunity is available with the structure of domains. Below is a diagram to help visualize what domains are and access rights.

Diagram of the principles of Domains


    Another form of protections is through language-based, which are found within the operating system kernel, which it tries to be a security agent that inspects and validates each attempt to access protected resources (Silberschatz et al, 2014). As operating systems become more advanced the developers have continued to try and provide higher-level user interfaces, and the goals of protection are becoming more refined (Silberschatz et al, 2014). In more recent times, protection systems are now more concerned with the identity of resources and accesses that are attempted on these resources but now also are concerned with the functional nature of that access. In current times protection systems have begun to establish functions to go beyond the set of system-defined functions, like the standard file-access methods which include functions that are user-defined.

            One way protection on domains and objects are through the access rights matrix, the matrix consists of a set of rights, these rights range from a select grouping of rights. The mechanism defines access rights for what process can do on the domain they are executed on. Below is a diagram to help incorporate the matrix into a more functional concept of what access rights belong to what process on each domain.

Diagram of Matrix Access



Security systems are put in place to prevent malicious and unwanted activity that may compromise a system, network, or even personal information, how security systems are intended to work as long as the users correctly use the system use and have appropriate access rights to these resources. Acknowledging that if all resources within a computer system are accessed appropriately and intended then we can feel that the system is accurately working and secure. A few different methods that security is used in terms of protecting against malicious activity start with physical security measures, which dictates that if a site or sites that contain computer systems, they must be physically secured against unwanted/malicious activity (Silberschatz et al, 2014). Another method to prevent activity that is found within security is human authentication, this is giving authorization to only appropriate users who need to access certain files, systems, or information. The operating system itself must have its own security measures to help prevent malicious activity and attacks towards that computer system. Another technique to protect systems, programs, and networks would be the use of cryptography. According to Silberschatz et al (2014), “cryptography is used to constrain the potential senders and/ or receivers of a message” (Section 14.4). This type of security is a way for a computer to recognize if a message is sent/received is authentic by using keys. Keys are ways for users to decode/encode messages so that only a computer with certain keys can view these messages. This leads to the encryption process, which essentially is converting information or data into a code that attempts to prevent unauthorized access. Another great form of security found within operating systems are firewalls, this is a software layered security measure that limits the communications to/from a given host, this would deny malicious activity from sending stolen information from the victim computer to a hacker that is using the internet access to steal information.

Concept Map of Security and Protection



 

 

References

Patterson, D. A., & Hennessy, J. L. (2014). Computer organization and design: The hardware/software interface (5th ed.). Retrieved from https://zybooks.zyante.com/#/zybook/jCx8rOUvAL/gettingstarted

 

Silberschatz, A., Galvin, P. B., & Gagne, G. (2014). Operating system concepts essentials (2nd ed.). Retrieved from https://redshelf.com/