21 Oct 2016

Lecture 1

Overview of today’s lecture
Introduction to what an operating system is?
Issues involved in the design of an operating system
Different types of operating systems

Lets start
What is an operating system?

Top-down view
Provides an extended or virtual machine abstraction to user programs
Easier to program than the underlying hardware.
All services are invoked and accomplished through system calls.


Bottom-up view
Acts as a resource manager of a complex system
Resources consist of processors, memories, timers, disks, mice, keyboard, network
interfaces, printers etc.
OS manages allocation of these resources to user programs in an orderly and controlled
manner


Resource multiplexing
OS multiplexes resources in two ways:
In time, In space
Time multiplexing involves different programs taking turns in using the resource.
Example: CPU scheduling, printer sharing.
Space multiplexing involves different program getting part of the resource possibly at the
same time. Example: memory is divided into several running programs.

The major OS issues
Structure: how is the OS organized?
Sharing: how are resources shared across users?
Naming: how are resources named (by users or programs)?
Security: how is the integrity of the OS and its resources ensured?
Protection: how is one user/program protected from another?
Performance: how do we make it all go fast?
Reliability: what happens if something goes wrong (either with hardware or with
program)?
Extensibility: can we add new features?
Communication: how do programs exchange information, including across a network?

More OS issues
Concurrency: how are parallel activates (computation and I/O created and controlled?
Scale: what happens as demands or resources increase?
Persistence: how do you make data last longer than program executions?
Distribution: how do multiple computers interact with each other?
Accounting: how do we keep track of resources usage, and perhaps charge for it?

Type of Operating Systems

Main frame operating systems:

  • Huge amounts of I/O activity.
  • Transaction and time sharing services.
  • Batch processing is routine non-interactive jobs. e.g. claims processing, sales
  • reporting etc. Transaction processing systems handle large number of small
  • requests e.g. check processing in banks, air line reservations etc.
  • Time-sharing systems allow multiple remote users to run jobs at the same time e.g.
  • querying a database. OS Optimized for these tasks. Example is OS/390

Server operating systems

  • Run on very large PCs, workstations or even main-frames. They serve multiple users over a network simultaneously 
  • And allow them to share hardware and software. Examples are web servers, database transaction servers etc. Examples of
  • OS in this class are Win2K, XP and flavors of UNIX.

Multiprocessor operating systems

  • OS is basically a variation to server operating systems with special provisions for connectivity and communication management between different CPUs.

PC operating systems

  • OS provides a nice interface to a single user.
  • Typically used for word processing, spread sheets, Internet access etc.

Real-time operating systems

  • Characterized by time as the key parameter. Real-time response to internal and external events is more important than any other design goal. Classified into two sub-categories: Hard and Soft real-time.
  • Example applications include Industrial process control, robotics and assembly lines, air traffic control, network routers and telecommunication switches, multi-media systems etc.

Embedded operating systems

  • Embedded in small devices e.g. palm-top computers e.g. PDA, TV sets, micro-wave ovens, mobile phones. They have characteristics of real-time systems (mainly soft real-time) but also have restraints on power consumption, memory usage etc.
  • Examples include PalmOS and Windows CE. Height of this type is smart-card systems.

Distributed Systems

  • Distribute the computation among several physical processors.

Loosely coupled system

  • Each processor has its own local memory; processors communicate with one another through various communications lines, such as high-speed buses or telephone lines.
  • Advantages of distributed systems:
    • Resources Sharing, Computation speed up – load sharing, Reliability, Communications

Parallel Systems

  • Multiprocessor systems with more than on CPU in close communication.

Tightly coupled system

  • Processors share memory and a clock; communication usually takes place through the shared memory.
  • Advantages of parallel system
    • Increased throughput, Economical, Increased reliability, graceful degradation, fail soft systems.

Important Links


Assignment Solutions:
http://vustudents.ning.com/group/cs703advancedoperatingsystems
http://ebridge.pk/tag/cs703-2nd-assignment-solution/
http://vuinnovators.com/category/mscs/cs703/
https://helpdeskforbeginner.blogspot.com/2016/10/mscs-course-cs703-old-assignment-help.html#more

Books Download Link:
Reference Book 1:
Modern Operating Systems by Tanenbaum
Download Link:
http://www.vumultan.com/Books/CS703-Modern-Operating-Systems.pdf
Reference Book 2:
Operating Systems Concepts by Siberschatz, Galvin, Gagne
Download Link:
http://www.vumultan.com/Books/Operating-Systems-Concepts.pdf


20 Oct 2016

May 29- Mid Term 703

1.Benefits of different time quatum.
2.advantage of high synchronization construct over semaphore.
3.client server architecture working.
4.working of long term scheduler.

CS 703 31-05-2016 TIME : 9:00 am


Q#1. Suppose that a system is in an unsafe state. Show that that is possible for the process to completed their execution without entering a deadlock state.
Q#2.Major uses of threads.
Q#3.Possibility thread created or not.Write the possibility of failure thread creation.
Q#4.diagram ti us mai Quantum 8 or aik quantum 16 diya huwa ta next FCFS likha ta
a.which process will complete execution 2nd queue.
b.How move different queue how enter into different queues...

CS 703 30-05-2016 TIME : 7:30 am

Q#1. Suppose that a system is in an unsafe state. Show that that is possible for the process to completed their execution without entering a deadlock state.
Q#.2. Threads open resource sharing, are threads harmful for the system give solid reason?
Q#3. Do you think there are some events in computer systems that causes CPU scheduling?
Q#4. An operating system is running three concurrent P1,P2,P3 for three different users. each process require six units of computing time . P1 consist of a single thread, P2 consists of two threads , each requiring three of P2,S SIX TOTAL UNIT COMPUTING TIME....................
a) Suppose that the threads are kernel-supported and the kernel implements peemptive, round-robin scheduling of threads with a quantum on one time unit. of the first six units of time how many will devoted to each of the three process?
b) suppose threads are implemented entirely at the user level, and that .............

McQs Midterm

1.Asynchronous exception are caused by events external to the __________.
Processor
Memory
Vector Table
Data range
2.In _______memory allocator application allocates and frees space.
Dynamic
Explicit 
Implicit 
Static
3. To show free block in implicit list method we use _____ digit.
0
00
11
1
4. In reference counting, each ______has “ref count” of pointers to it.
Object
Block
Heap Address
Stack
5. A task in Linux that is present in the run queue (ready queue) at any given time has its state set to_______. 
TASK_INTERRUPTIBLE 
TASK_STOPPED
TASK_RUNNING
TASK_ZOMBIE
6. A process _______ defines the readiness of the process to be scheduled for execution.
Scheduler
Counter
State
Executer
7. Functions that are called from a thread must be thread ______.
Safe
Oriented
Dependent
Independent

For More: http://vuinnovators.com/cs703-current-paper-mcqs-solved/

Midterm Question

Diffeeence between Long term scheduler, medium term and short term scheduler. How long term scheduler helps.. (10)
Uses of threads (5)
One code was given, I have to tell the logic of that code. (5)
And last question was about high-level synchronization advantages over semaphore. (5)

Todays 703 paper - August 2016

10 mcqs
11: discuss arena allocator pattrens
12: explain FCFS is usefule in single user enviromrnt
13: difrerene of policy and mechanism
14: describe ways of real time system
15: we disccuss the file systems explain which system is better and why?
16: how virus works and spread explain with example
17: describe two ways for FIFO and LRU page replacement algorithms

Bulk - Final Paper

todays 703 paper
mcqs new thy recent papers men se just 3 thy .10
Q.Briefly explain major security issues. 10
Answer:
• Isolation
Separate processes execute in separate memory space
Process can only manipulate allocated pages
• Authentication
Who can access the system. Involves proving identities to the system
• Access control
When can process create or access a file?
Create or read/write to socket?
Make a specific system call?
• Protection problem
Ensure that each object is accessed correctly and only by those processes that are allowed to do so
• Comparison between different operating systems
Compare protection models: which model supports least privilege most effectively?
Which system best enforces its protection model?
Q. When a program enters into an infinite loop and never returns control back to CPU. Explain how timer interrupts help to terminate this condition?
Answer: An infinite loop (also known as an endless loop or unproductive loop) is a sequence of instructions in a computer program which loops endlessly, either due to the loop having no terminating condition, having one that can never be met, or one that causes the loop to start over. In older operating systems with cooperative multitasking, infinite loops normally caused the entire system to become unresponsive. With the now-prevalent preemptive multitasking model, infinite loops usually cause the program to consume all available processor time, but can usually be terminated by the user. Busy wait loops are also sometimes called "infinite loops". One possible cause of a computer "freezing" is an infinite loop; others include thrashing, deadlock, and access violations.
So long as the system is responsive, infinite loops can often be interrupted by sending a signal to the process (such as SIGINT in Unix), or an interrupt to the processor, causing the current process to be aborted. This can be done in a task manager, in a terminal with the Control-C command, or by using the kill command or system call. However, this does not always work, as the process may not be responding to signals or the processor may be in an uninterruptible state, such as in the Cyrix coma bug (caused by overlapping uninterruptible instructions in an instruction pipeline). In some cases other signals such as SIGKILL can work, as they do not require the process to be responsive, while in other cases the loop cannot be terminated short of system shutdown.
Q.Differentiate static permission inheritance and dynamic permission inheritance.5
Q.how we can overcome fragmentation ?5
Q. if a file is saved and than removes .. files remove but still link are active . now if you save a new file with the same name at same path what problem occur and how we can avoid this problem. 5.
Q.(a) How many bytes are contained within the physical memory?
(b) How large is the virtual address?
(c) What is the physical address that corresponds to virtual address 0x312?
(d) What is the physical address that corresponds to virtual address 0x1E9?
Solution
(a) Number of bytes in physical memory is equal to 2 ^(7 + 7) = 16K bytes. This is because 12 bits are required to address physical memory location out of which 3 bits are to refer frame no. within page table + 2 bits to locate page from segment and remaining 7 bits for offset with frame.
(b) The size of virtual memory is 2 ^ 20 ( 20 = 2 for segment index, + 3 for page table index + 3 for frame index in page table + 7 for frame number and 5 for offset within frame).
(c) 312 (Hex) = 001100010010 = 00(segment) in table number 3 (refer to the data in question at entry 0 in segment table then find page 3, in page 3 find 110 (6th entry) which is 78; that is 120 th frame then the offset with the frame is given by the last 7 bits 0010010.
Q.Describe the functionality of each line. (Marks 10)….
/*Parents code*/
Ssize-tread(int fd,void*buf,size-tcount)
1-close(pipe fd[1]);
2-n=strln(teststring);
3-nr=read(pipefd[0],buf,nA);
4-rc=write(1,buf,nr);
5-wait(&status);
6-printf(“Good work child!\n”);
7-return(0);
}
Ans . read() reads count bytes in buf from fd; then it closes the fd file descriptor on pipe ; strlen() returns length of teststring ; same as read did before; then write writes to buf ; wait() blocks the caller and terminates the child; print goodluck n return zero....

18 Oct 2016

Installing Codeignitor on Xampp

Folder structure of Codeigntior


Step1):config base_url and index_page.
Path: application/config/config.php

$config['base_url'] = 'http://localhost/cig';

Open addresses in browser - http://localhost/cgi[project name = cgi] or localhost or localhost/xampp/

Welcome

Optional

Database: application/config/database.php

In Codeigniter Routing is very important. Default route for web application.
$route[‘default_controller’] = “Welcome”;
$route[‘404_override’] = ”;

Here I changed welcome to login
$route[‘default_controller’] = “login”;
$route[‘404_override’] = ”;

For handling the form data you have to ser TRUE instead of FALSE in config.php
Global XSS Filtering.
$config[‘global_xss_filtering’] = TRUE;

Setup Environment for laravel in Windows

To setup Laravel I have several choices in mind

  • Setting Up Xampp Tutorial.
  • Lets, install it on the earlier VM I have.
  • laravel/homestead
Laravel homestead Documentation Page - I follow the instruction mentioned on this page and install the following software's.
The Next I want to do is to run command after so many tries I find it that I can only run vagrant command in windows admin command-prompt (Such as vagrant box add laravel/homestead) and it will take time to setup box



With this, I confused a bit that Maybe Virtual Box required linux version Debian or Linux mint to setup before initiate the working of vegrant/laravel but Its not needed.

After Affects - Things to remember

Split - cntrl+shift+D
Duplicate - cntrl+D
Pen-tool - select clip and press G

Creating Project From Scratch in CodeIgniter 3.1.0 on Xampp


Step 1) 
Download:

  • Codeigniter 
  • Twitter Bootstrap (http://getbootstrap.com/2.3.2/)

Create New Folder (project name) in Xampp htdocs and Combine sub-folders of both
Bring .htaccess file from application folder to root folder
Some of files like (User Guide or licence are not needed to copy here)

Step 2)
.Htaccess file (Below permission) shows Permission denied error at Front-End. It need to replace with another code

Code to Remove
<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>

This will remove index.php from Url
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

Codeigniter 3.1.0 Overview

Config folder files -

  • autoload- We need to include library in autoload before used so it will load automatically when needed.
  • database- to include DB
  • route- to handle default controllers like 404 welcome etc

Index.php - Any Url Request will be handle by this file like (about us or contact us)

  • index.php/[controller]/[method]
  • Controllers and functions/methods are defined in this file
  • Initially We Need to Define Controller like Welcome.php
  • multple functions/method in controller
  • class Welcome extends CI_Controller {
  • File must be protected following this condition
    • defined('BASEPATH') OR exit('No direct script access allowed');
  • If we call to (index.php/Welcome.php/)
    • It shows error because we didn't define index () function
    • public function index()
    • {
    • $this->load->view('welcome_message');
    • }
  • But if we call to another function Public function test ()
    • (index.php/Welcome.php/test)
    • It will works even without index () function

How to Paste image Directly in Blogspot, blog (blogger) or wordpress

I used snipping tool to take screenshot in my windows.
After that to copy paste that image into blogger needs two steps:

Step 1) Paste that image directly (without saving) into https://onpaste.com/
Step 2) Now, Image is copied and showing in the canvas of onpaste.com
  • Right Click on the image and select (copy image)
  • Paste(Ctrl + V) in the blog directly.

Codeigniter 3.1.0 Lecture 1 (Controllers and View)

Add test function and open the Url http://localhost/cig/index.php/welcome/test


Url Structure (http://localhost/cig/index.php/Controller/function)

Lets create New Controller UnderConstruction and view under_construction
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class UnderConstruction extends CI_Controller {

/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/underconstruction
* - or -
* http://example.com/index.php/underconstruction/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/underconstruction/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/

public function index()
{
$this->load->view('under_construction');
}
public function test() {
echo "Works Well";
}
}
It will show 404 error - if index () function is missing
http://localhost/cig/index.php/underconstruction/test - Open this Url
It will provoke the specific function inside the controller

In View Section just copy paste welcome_message and little edit it.
$this->load->view('blob/under_construction');
If our view under_construction is located in view->blog-> then we must have to mention blog, as by default all views are fetched from root folder.