Os-Unit 5-BSC
Os-Unit 5-BSC
Os-Unit 5-BSC
There are several logical structures of a directory, these are given below.
1.Single-level directory:
The single-level directory is the simplest directory structure. In it, all files are
contained in the same directory which makes it easy to support and
understand.
A single level directory has a significant limitation, however, when the number
of files increases or when the system has more than one user. Since all the
files are in the same directory, they must have a unique name. If two users call
their dataset test, then the unique name rule violated.
Advantages:
Since it is a single directory, so its implementation is very easy.
If the files are smaller in size, searching will become faster.
The operations like file creation, searching, deletion, updating is very easy in
such a directory structure.
2.Two-level directory:
As we have seen, a single level directory often leads to confusion of files names
among different users. the solution to this problem is to create a separate
directory for each user.
In the two-level directory structure, each user has their own user files
directory (UFD). The UFDs have similar structures, but each lists only the files
of a single user.
system’s master file directory (MFD) is searches whenever a new user id=s
logged in. The MFD is indexed by username or account number, and each
entry points to the UFD for that user.
Advantages:
We can give full path like /User-name/directory-name/.
Different users can have the same directory as well as the file name.
Searching of files becomes easier due to pathname and user-grouping.
3.Tree-structured directory –
Once we have seen a two-level directory as a tree of height 2, the natural
generalization is to extend the directory structure to a tree of arbitrary height.
This generalization allows the user to create their own subdirectories and to
organize their files accordingly.
A tree structure is the most common directory structure. The tree has a root
directory, and every file in the system has a unique path.
Advantages:
Very general, since full pathname can be given.
Very scalable, the probability of name collision is less.
Searching becomes very easy, we can use both absolute paths as well as
relative.
******.
File Operations
A file is a collection of related information that is stored on secondary storage. Or
file is a collection of logically related entities. The name of the file is divided into
two parts: name and extension, separated by a period.
A file is an abstract data type. To define a file properly, we need to consider the
operations that can be performed on files.
Six basic file operations. The OS can provide system calls to create, write, read,
reposition, delete, and truncate files.
#include<unistd.h>
2. Double Buffer :
In Double Buffering, two schemes or two buffers are used in the place of one. In
this buffering, the producer produces one buffer while the consumer consumes
another buffer simultaneously. So, the producer not needs to wait for filling the
buffer. Double buffering is also known as buffer swapping.
3. Circular Buffer :
When more than two buffers are used, the buffers' collection is called a circular
buffer. Each buffer is being one unit in the circular buffer. The data transfer rate
will increase using the circular buffer rather than the double buffering.
In this, the data do not directly pass from the producer to the consumer because the data
would change due to overwriting of buffers before consumed.
The producer can only fill up to buffer x-1 while data in buffer x is waiting to be consumed.
Advantages of Buffer:
Buffering plays a very important role in any operating system during the execution of any process or
task. It has the following advantages.
The use of buffers allows uniform disk access. It simplifies system design.
The system places no data alignment restrictions on user processes doing I/O. By copying
data from user buffers to system buffers and vice versa, the kernel eliminates the need for
special alignment of user buffers, making user programs simpler and more portable.
The use of the buffer can reduce the amount of disk traffic, thereby increasing overall system
throughput and decreasing response time.
The buffer algorithms help ensure file system integrity.
******
Shared Memory
Shared memory system is the fundamental model of inter process
communication. In a shared memory system, in the address space region the
cooperating communicate with each other by establishing the shared memory
region. Shared memory concept works on fastest inter process communication.
If the process wants to initiate the communication and it has some data to share,
then establish the shared memory region in its address space. After that, another
process wants to communicate and tries to read the shared data, and must attach
itself to the initiating process’s shared address space.
Let us see the working condition of the shared memory system step by step.
Working:
In the Shared Memory system, the cooperating processes communicate, to
exchange the data with each other. Because of this, the cooperating processes
establish a shared region in their memory. The processes share data by reading
and writing the data in the shared segment of the processes.
Let us discuss it by considering two processes.
The diagram is shown below −
Let the two cooperating processes P1 and P2. Both the processes P1 and P2, have their different
address spaces. Now let us assume, P1 wants to share some data with P2.
Step 1 − Process P1 has some data to share with process P2. First P1 takes initiative and establishes
a shared memory region in its own address space and stores the data or information to be shared in
its shared memory region.
Step 2 − Now, P2 requires the information stored in the shared segment of P1. So, process P2 needs
to attach itself to the shared address space of P1. Now, P2 can read out the data from there.
Step 3 − The two processes can exchange information by reading and writing data in the shared
segment of the process.
Advantages
Various operating system security policies may be implemented based on the organization
that you are working in. In general, an OS security policy is a document that specifies the
procedures for ensuring that the operating system maintains a specific level of integrity,
confidentiality, and availability.
OS Security protects systems and data from worms, malware, threats, ransomware, backdoor
intrusions, viruses, etc. Security policies handle all preventative activities and procedures to
ensure an operating system's protection, including steal, edited, and deleted data.
As OS security policies and procedures cover a large area, there are various techniques to
addressing them. Some of them are as follows:
OS security policies and procedures are developed and implemented to ensure that you must
first determine which assets, systems, hardware, and date are the most vital to your
organization. Once that is completed, a policy can be developed to secure and safeguard them
properly.
Security refers to providing a protection system to computer system resources such as CPU,
memory, disk, software programs and most importantly data/information stored in the
computer system. If a computer program is run by an unauthorized user, then he/she may
cause severe damage to computer or data stored in it. So a computer system must be
protected against unauthorized access, malicious access to system memory, viruses, worms
etc. We're going to discuss following topics in this chapter.
Authentication
One Time passwords
Program Threats
System Threats
Computer Security Classifications
1.Authentication:
Authentication refers to identifying each user of the system and associating the executing
programs with those users. It is the responsibility of the Operating System to create a
protection system which ensures that a user who is running a particular program is authentic.
Operating Systems generally identifies/authenticates users using following three ways −
Username / Password − User need to enter a registered username and password with
Operating system to login into the system.
User card/key − User need to punch card in card slot, or enter key generated by key
generator in option provided by operating system to login into the system.
User attribute - fingerprint/ eye retina pattern/ signature − User need to pass
his/her attribute via designated input device used by operating system to login into the
system.
One-time passwords provide additional security along with normal authentication. In One-
Time Password system, a unique password is required every time user tries to login into the
system. Once a one-time password is used, then it cannot be used again. One-time password
are implemented in various ways.
Random numbers − Users are provided cards having numbers printed along with
corresponding alphabets. System asks for numbers corresponding to few alphabets
randomly chosen.
Secret key − User are provided a hardware device which can create a secret id mapped
with user id. System asks for such secret id which is to be generated every time prior to
login.
Network password − Some commercial applications send one-time passwords to user
on registered mobile/ email which is required to be entered prior to login.
********
PROTECTION
There are four levels at which a system must be protected:
1. Physical - The easiest way to steal data is to pocket the backup tapes. Also, access to the root
console will often give the user special privileges, such as rebooting the system as root from
removable media. Even general access to terminals in a computer room offers some
opportunities for an attacker, although today's modern high-speed networking environment
provides more and more opportunities for remote attacks.
2. Human - There is some concern that the humans who are allowed access to a system be
trustworthy, and that they cannot be coerced into breaching security. However more and more
attacks today are made via social engineering, which basically means fooling trustworthy
people into accidentally breaching security.
o Phishing involves sending an innocent-looking e-mail or web site designed to fool
people into revealing confidential information. E.g. spam e-mails pretending to be
from e-Bay, PayPal, or any of a number of banks or credit-card companies.
o Dumpster Diving involves searching the trash or other locations for passwords that
are written down. ( Note: Passwords that are too hard to remember, or which must be
changed frequently are more likely to be written down somewhere close to the user's
station. )
o Password Cracking involves divining users passwords, either by watching them type
in their passwords, knowing something about them like their pet's names, or simply
trying all words in common dictionaries. ( Note: "Good" passwords should involve a
minimum number of characters, include non-alphabetical characters, and not appear in
any dictionary ( in any language ), and should be changed frequently. Note also that it
is proper etiquette to look away from the keyboard while someone else is entering their
password. )
3. Operating System - The OS must protect itself from security breaches, such as runaway
processes ( denial of service ), memory-access violations, stack overflow violations, the
launching of programs with excessive privileges, and many others.
4. Network - As network communications become ever more important and pervasive in
modern computing environments, it becomes ever more important to protect this area of the
system. ( Both protecting the network itself from attack, and protecting the local system from
attacks coming in through the network. ) This is a growing area of concern as wireless
communications and portable devices become more and more prevalent.
******
Assuming that someone has logged in to a computer operating system or application, the system or
application may want to identify what resources the user can be given during this session. Thus,
authorization is sometimes seen as both the preliminary setting up of permissions by a system
administrator and the actual checking of the permission values that have been set up when a user is
getting access.
Authorization is a process by which a server determines if the client has permission to use a
resource or access a file.
Authorization is usually coupled with authentication so that the server has some concept of
who the client is that is requesting access.
The type of authentication required for authorization may vary; passwords may be required
in some cases but not in others.
In some cases, there is no authorization; any user may be use a resource or access a file
simply by asking for it. Most of the web pages on the Internet require no authentication or
authorization.
Most web security systems are based on a two-step process. The first step is authentication, which
ensures about the user identity and the second stage is authorization, which allows the user to access
the various resources based on the user's identity. Modern operating systems depend on effectively
designed authorization processes to facilitate application deployment and management.
Key factors contain user type, number and credentials, requiring verification and related actions and
roles.
Access control in computer systems and networks relies on access policies and it is divided into
two phases:
Thus authorization is the function of the policy definition phase which precedes the policy
enforcement phase where access requests are permitted or not permitted based on the previously
defined authorizations.
Access control also uses authentication to check the identity of consumers. When a consumer
attempts to access a resource, the access control process investigates that the consumer has been
authorized to use that resource. Authorization services are implemented by the Security Server
which can control access at the level of individual files or programs.
******
Android is a Linux-based operating system it is designed primarily for touch screens mobile
devices such as smartphones and tablet computers. The operating system has developed a lot in the
last 15 years starting from black and white phones to recent smartphones or mini computers. One of
the most widely used mobile OS these days is android. The android is software that was founded in
Palo Alto of California in 2003.
The Android operating system is a mobile operating system that was developed by Google (GOOGL
) to be primarily used for touchscreen devices, cell phones, and tablets. Its design lets users
manipulate the mobile devices intuitively, with finger movements that mirror common motions, such
as pinching, swiping, and tapping. Google also employs Android software in televisions, cars, and
wristwatches—each of which is fitted with a unique user interface.
Below are the following unique features and characteristics of the android operating system, such as:
Most Android devices support NFC, which allows electronic devices to interact across short
distances easily. The main goal here is to create a payment option that is simpler than carrying cash
or credit cards, and while the market hasn't exploded as many experts had predicted, there may be an
alternative in the works, in the form of Bluetooth Low Energy (BLE).
2. Infrared Transmission
The Android operating system supports a built-in infrared transmitter that allows you to use your
phone or tablet as a remote control.
3. Automation
The Tasker app allows control of app permissions and also automates them.
You can download apps on your PC by using the Android Market or third-party options like
AppBrain. Then it automatically syncs them to your Droid, and no plugging is required.
Android phones also have unique hardware capabilities. Google's OS makes it possible to upgrade,
replace, and remove your battery that no longer holds a charge. In addition, Android phones come
with SD card slots for expandable storage.
While it's possible to hack certain phones to customize the home screen, Android comes with this
capability from the get-go. Download a third-party launcher like Apex, Nova, and you can add
gestures, new shortcuts, or even performance enhancements for older-model devices.
7. Widgets
Apps are versatile, but sometimes you want information at a glance instead of having to open an app
and wait for it to load. Android widgets let you display just about any feature you choose on the
home screen, including weather apps, music widgets, or productivity tools that helpfully remind you
of upcoming meetings or approaching deadlines.
8. Custom ROMs
Because the Android operating system is open-source, developers can twist the current OS and build their versions,
which users can download and install in place of the stock OS. Some are filled with features, while others change the
look and feel of a device. Chances are, if there's a feature you want, someone has already built a custom ROM for it.
Android Architecture
1. linux kernel
2. native libraries (middleware),
3. Android Runtime
4. Application Framework
5. Applications
1) Linux kernel
2) Native Libraries
On the top of linux kernel, their are Native libraries such as WebKit, OpenGL,
FreeType, SQLite, Media, C runtime library (libc) etc.
The WebKit library is responsible for browser support, SQLite is for database,
FreeType for font support, Media for playing and recording audio and video
formats.
3) Android Runtime
In android runtime, there are core libraries and DVM (Dalvik Virtual Machine)
which is responsible to run android application. DVM is like JVM but it is
optimized for mobile devices. It consumes less memory and provides fast
performance.
4) Android Framework
On the top of Native libraries and android runtime, there is android framework.
Android framework includes Android API's such as UI (User Interface), telephony,
resources, locations, Content Providers (data) and package managers. It provides a
lot of classes and interfaces for android application development.
5) Applications
On the top of android framework, there are applications. All applications such as
home, contact, settings, games, browsers are using android framework that uses
android runtime and libraries. Android runtime and native libraries are using
linux kernal.
*******
1. Ionic
Ionic Framework is a very popular open-source mobile framework that was
released in 2013. It’s also free and MIT open source (so it will most probably
remain free!). According to its website, Ionic can be used to “Build and ship
beautiful cross-platform hybrid and Progressive Web Apps with ease.” And
that’s not all! Ionic is also a cross-platform framework, which means that you can
create apps and then customize them for Android, iOS, Windows, etc. Also, if you
have a problem with your documentation, fear not! Ionic has documentation
support with real-life examples.
2. Xamarin
Xamarin is an extremely popular Mobile framework(With over 1.4 million
developers using it!) that was acquired by Microsoft in 2016 and is currently a
Microsoft subsidiary. According to Xamarin, “Apps built using Xamarin look and
feel native because they are.” So basically, Xamarin can be used to write native
Android, iOS and Windows apps with a C# codebase (Xamarin is great for C#
developers!) that can also be shared across multiple platforms. Xamarin is also
popular (and only!) IDE with Microsoft Visual Studio and can be used to create
native apps with AutoComplete and IntelliSense.
3. Adobe PhoneGap
Adobe PhoneGap is an open-source mobile application development framework
that was purchased by Adobe Systems in 2011. Its unique feature is that it can be
used to build mobile applications using HTML5, CSS3, and JavaScript instead of
using API like Android, iOS, or Windows Phone. According to PhoneGap, it can be
used to “Reuse existing web development skills to quickly make hybrid
applications built with HTML, CSS, and JavaScript.”
4. React Native
React Native is an open-source mobile framework that was created by Facebook
and released in 2015. According to Mark Zuckerberg, “The biggest mistake we
made as a company was betting too much on HTML as opposed to native”
and that lead to the creation of React Native. It provides support for various IDEs
and mobile app development tools and that is one of the main reasons it is used
by many (popular!) companies such as Instagram, Tesla, Walmart, Baidu, etc. to
develop their mobile apps.
5. Flutter
Flutter is a comparatively recent open-source development framework that was
released by Google in 2017. According to Google, “Flutter is Google’s portable UI
toolkit for building beautiful, natively-compiled applications for mobile, web,
and desktop from a single codebase.” Flutter is written in the Dart
programming language (Also developed by Google) and it is currently used by
famous companies such as Alibaba, Tencent, Google (Of course!). Flutter provides
rendering support by using the 2D rendering engine Skia.
6. Titanium SDK
Titanium SDK is an open-source framework that was created by Appcelerator, Inc.
and released in 2018. (It’s quite new!) It is basically a development environment
that can be used to create native apps across various operating systems like iOS,
Android, BlackBerry, etc. Titanium is quite popular and has been used in around
70, 000+ Mobile Applications till now. And that’s not all! According to the
Titanium website “The Titanium environment helps organizations get to
market 60% faster and achieve a significant competitive advantage.”
7. JQuery Mobile
JQuery Mobile is a Touch-Optimized Web Framework that was developed by the
jQuery team and released in 2010. It is based on HTML5 and can be used to
create responsive web sites and apps that can be accessed using multiple devices
such as smartphones, tablets, desktops, etc. According to the jQuery team, this
takes the “write less, do more” mantra to the next level!!! In addition to that,
jQuery also provides support for different operating systems such as Windows,
Firefox, Mac OS, Blackberry, Kindle, etc.(So make your choice!)
8. Corona SDK
Corona Software Development Kit was developed by Corona Labs Inc. and released
in 2009. It is a great platform for creating apps for mobile as well as desktop
systems. Corona Labs states that “You can create your project once and
publish it to multiple types of devices, including Apple iPhone and iPad,
Android phones and tablets, Windows Desktop, etc.” Also, Corona is incredibly
fast as it is supported by Lua, an open-source scripting language that is
lightweight, fast, and powerful as well (Triple whammy!)
9. Native Script
Native Script is an open-source framework for creating native (duh!) mobile apps
that were developed by Progress and initially released in 2014. It was developed
using JavaScript and TypeScript (which is basically a superset of JavaScript).
Native Script also supports Angular and Vue.js frameworks and these can be used
to share existing web-based code. It also doesn’t hurt that Native Script is 100%
free and open source!
Figure
Program and process
Let us have a quick glance on these constituents of the process in memory and
they are:
Process State:
Just like liquid changes its state process too changes its states during execution.
Major transition states of process are namely:
The states that they represent are found on all systems but certain operating
systems also more finely delineate states of process. The names may vary
according to different operating systems. There can be more than one process
which are in ready or waiting state but at any instant of time one and only one
process can be in running state at one processor. Pictorial representation of
process states is as follows:
You must be thinking there are so many processes and how are they going to be
represented in operating system well, we have process control block which
uniquely represents each process in operating system. It is also called task control
block. PCB contains associated information which is as follows:
Android can host variety of applications and it is designed in a way which removes
redundancy or duplication of functionalities in different applications or to allow
functionality to be discovered, etc.
There are two major techniques related to interprocess communication and they
are namely;
Intents: These enable an application to select an Activity based on the
action you want to invoke and the data on which they operate. Hardcoded
path to an application is needed to use its functions and exchange data with
it. With intent objects data can be used t pass objects in both directions. It
enables a high-level interprocess communication.
Remote methods: By this we mean the remote procedure calls (RPCs) with
this APIs can be accessed remotely. With remote calls, the methods appear
to be local which are executed in another process. Android Interface
Definition Language (AIDL) is used for this purpose.
******
Under the Android file system, there are usually six main partitions found on
every device. Some devices may come with a couple of additional partitions, those
differ from model to model, but there are six primary partitions that are found on
every single Android device. These include /boot, /system, /recovery, /data,
/cache, and /misc. Additionally, for external Android smartphone, there are two
file system partitions – /sdcard and /sd-ext. So, let’s break down each partition
separately and explore the Android File system hierarchy.
/boot
This partition consists of the Android kernel and the ramdisk. Basically, every
single thing that is needed to boot your Android device when powered on. You
should only proceed to wipe this partition from recovery if it is absolutely
necessary. If you do, once the partition is wiped, ensure to reboot the phone only
after installing a new boot partition. The new partition can be a /boot partition
found in a ROM.
/system
The system partition accommodates the entire Android OS. This includes the
Android GUI as well as the system apps that come pre-installed on Android
devices. So, what happens if you wipe this partition? Well, you can still boot the
device. We will only be able to put our device into recovery or bootloader mode.
/recovery
This partition is designed for backup and can be considered the alternative boot
option or partition in an Android device. It lets the device boot into recovery mode
where backing up data, wiping data, restoring phone to factory settings, and
performing other maintenance operations.
/data
Also known as user data partition, this partition consists of all of the user’s data,
including contacts, settings, apps and messages. Wiping the data partition will
lead to storing your phone to factory settings, having removed all of the apps,
messages, and user settings from the Android device.
/cache
This partition stores the frequently accessed app data and components. Wiping
this partition will just clear the built-up cache, and the device will simply go back
to rebuilding it as you continue using it. Clearing cache also frees up some space
in your device and can also fix certain issues at times.
/misc
This partition contains all the miscellaneous system settings, usually on/off
switches. The settings may include carrier or region ID, USB configuration, and
certain hardware setting. This partition is very important since it can cause
several device features to malfunction if the partition becomes corrupt or goes
missing. A missing /misc partition can also cause the Android device to not boot
at all.
/sdcard
This partition is the space that is available to users to store their files and data.
Depending on your device, you could even have more than one sdcard partition. If
your device has an external SD card slot, then the /sdcard partition refers to the
internal storage device, and the external SD card will be assigned a different
partition, either a new partition called /sdcard2 or a separate directory within the
/sdcard partition itself such as /sdcard/sd. Wiping the partition with the external
SID card storage is completely safe, as long as you have backed up any important
data or documents you may have on it. Wiping the /sdcard partition with the
external SD and storage is completely safe, as long as you have backed up any
important data or documents you may have on it. Wiping the /sdcard partition,
however, results in wiping some system and app data and settings, but it still
doesn’t hinder the system’s boot processor functionality.
/sd-ext
Without rooting your device, Android users typically can only access the data
partition. The contents of this partition are what you will see in most file
managers or when you connect it to a PC. If you have an external SD card
attached to the device, you will also be able to view the contents of it in this user-
accessible data partition. If your phone doesn’t come packing a decent file explorer
or manager, you can simply install one of the powerful third-party file manager
available on the Play Store. You can also browse your data files onPC via a USB
connection. However, ensure that your phone is in MTP (Media Transfer) or File
Transfer mode.
Android also divides its storage into three distinct categories, which is quite
different from a PC’s file system layout. Here is how it divides its storage:Device
storage – This refers to the pool of storage you can work with and access. You can
even modify files in this storage area.Portable SD card storage – This storage
area is allocated to external SD cards. You can load files into this and then insert
them into your device.Device root storage – Every Android device has a special
file system where all the root files are stored. This includes operating system files,
sensitive application data, system apps, and more. Users typically cannot modify
this file system for security and device safety reasons unless, of course, they have
root access.
In the most basic sense, ‘root’ refers to the topmost folder in the Android file
system. This would be the equivalent to the c:\ drive on Windows. Unlike
Windows, though, Android has built an invisible barrier about halfway up the file
system tree and only allows you to access certain files before you hit this virtual
wall, beyond which the root files lie. This is to stop users from making irreversible
or irreparable changes to critical OS files.
*******