Scientific Visualization Using imagery to aid humans in understanding a complicated phenomenon.

Slides:



Advertisements
Similar presentations
Question Bank. Explain the syntax of if else statement? Define Union Define global and local variables with example Concept of recursion with example.
Advertisements

Linux device-driver issues
C Language.
Unions The storage referenced by a union variable can hold data of different types subject to the restriction that at any one time, the storage holds data.
Slide 2-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 2 Using the Operating System 2.
1 Lecture 4: Procedure Calls Today’s topics:  Procedure calls  Large constants  The compilation process Reminder: Assignment 1 is due on Thursday.
1 Today’s lecture  Last lecture we started talking about control flow in MIPS (branches)  Finish up control-flow (branches) in MIPS —if/then —loops —case/switch.
Kernel Memory Allocator
The ATA/IDE Interface Can we write a character-mode device driver for the hard disk?
CS 4284 Systems Capstone Godmar Back Linking and Loading.
Week 7 - Friday.  What did we talk about last time?  Allocating 2D arrays.
I/O Multiplexing The role of the ‘poll()’ method in Linux device-driver operations.
The ‘system-call’ interface We see how an application program can invoke privileged kernel services.
The Linux PCI Interface An introduction to the PCI configuration space registers.
Linux Memory Issues An introduction to some low-level and some high-level memory management concepts.
IA32 Paging Scheme Introduction to the Pentium’s support for “virtual” memory.
Page-Faults in Linux How can we study the handling of page-fault exceptions?
Character Driver Issues Implementing ‘/dev/physmem’
Linux Memory Management High-Level versus Low-Level.
Memory Image of Running Programs Executable file on disk, running program in memory, activation record, C-style and Pascal-style parameter passing.
“Virtual” Memory How does the OS kernel provide “private” and “shared” memory areas to multiple concurrent processes?
CS 635 Advanced Systems Programming Spring 2003 Professor Allan B. Cruse University of San Francisco.
How to make a pseudo-file As a follow-up to our first lab, we examine the steps needed to create our own ‘/proc’ file.
The kernel’s task list Introduction to process descriptors and their related data-structures for Linux kernel version
Linux Memory Issues Introduction. Some Architecture History 8080 (late-1970s) 16-bit address (64-KB) 8086 (early-1980s) 20-bit address (1-MB) (mid-’80s)
The kernel’s task list Introduction to process descriptors and their related data-structures for Linux kernel version
Rapid prototyping of LKMs Configuring our Linux systems for the quick creation and use of loadable kernel modules.
OPERATING SYSTEMS Introduction
Arrays Data Structures - structured data are data organized to show the relationship among the individual elements. It usually requires a collecting mechanism.
Protected Mode. Protected Mode (1 of 2) 4 GB addressable RAM –( to FFFFFFFFh) Each program assigned a memory partition which is protected from.
Linux Memory Management How does the Linux kernel keep track of the Virtual Memory Areas that each process uses?
University of Washington CSE 351 : The Hardware/Software Interface Section 5 Structs as parameters, buffer overflows, and lab 3.
Week 4 - Friday.  What did we talk about last time?  Some extra systems programming stuff  Scope.
Copyright 2013 – Noah Mendelsohn Process Memory Noah Mendelsohn Tufts University Web:
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Elements of a C++ program 1. Review Algorithms describe how to solve a problem Structured English (pseudo-code) Programs form that can be translated into.
CIS Computer Programming Logic
CS 3204 Operating Systems Godmar Back Lecture 11.
RjpSystem Level Programming Operating Systems 1 Having fun withy the Unix Operating System Praxis Week 7 Rob Pooley.
Character Generation.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Array, Pointer and Reference ( I ) Ying Wu Electrical & Computer Engineering Northwestern University ECE230 Lectures Series.
Smashing the Stack Overview The Stack Region Buffer Overflow
Assembly Language for x86 Processors 7th Edition Chapter 13: High-Level Language Interface (c) Pearson Education, All rights reserved. You may modify.
Kirk Scott Computer Science The University of Alaska Anchorage 1.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 C Basics Tarek Abdelzaher and Vikram Adve.
Operating Systems CMPSC 473 Processes (3) September Lecture 9 Instructor: Bhuvan Urgaonkar.
JMU GenCyber Boot Camp Summer, Introduction to Penetration Testing Elevating privileges – Getting code run in a privileged context Exploiting misconfigurations.
Implementing ‘noecho’ Programming details regarding the Linux implementation for ‘struct termios’ objects.
Copyright 2014 – Noah Mendelsohn Code Tuning Noah Mendelsohn Tufts University Web:
COMP 3438 – Part I - Lecture 5 Character Device Drivers
Week 4 - Friday.  What did we talk about last time?  Some extra systems programming stuff  Scope.
Announcements There is a Quiz today. There were problems with grading assignment 2, but they should be worked out today The web page for correcting the.
Arrays. Outline 1.(Introduction) Arrays An array is a contiguous block of list of data in memory. Each element of the list must be the same type and use.
C Programming Day 2. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/LA07/003 Version No. 1.0 Union –mechanism to create user defined data types.
Computer Systems MTSU CSCI 3240 Spring 2016 Dr. Hyrum D. Carroll
CSNB334 Advanced Operating Systems 5. Memory Management
CS 5204 Operating Systems Linking and Loading Godmar Back.
Assembly Language Programming I: Introduction
CS 4284 Systems Capstone Linking and Loading Godmar Back.
Your questions from last session
Data Structures and Algorithms Introduction to Pointers
CS703 - Advanced Operating Systems
Displaying Memory/Files
Assembly Language for Intel-Based Computers, 5th Edition
C Language B. DHIVYA 17PCA140 II MCA.
Week 7 - Friday CS222.
Format String Vulnerability
Introduction to C CS 3410.
Presentation transcript:

Scientific Visualization Using imagery to aid humans in understanding a complicated phenomenon

An example from our class Student asked about ‘task_union’ objects “Can stack overwrite process descriptor?” Maybe we ought to be worried about this If descriptor gets corrupted, then: crash! System protects against users crashing But can’t protect if kernel code crashes!

One picture is worth 1000 words ‘modules’ let us study a running kernel We could look at a ‘task_union’ object But there are several design-issues How much ‘data’ will fit on one screen? How can we make ‘data’ understandable? How can we make a picture be ‘esthetic’? How much effort are we willing to devote?

Doing data amalgamation Size of a ‘task_union’ is 8KB Size of standard text screen is 2000 chars Not enough display-space for these bytes Idea: use a coarser subdivision of the data Subdivide a ‘task_union’ into quadwords Each quadword is 8-bytes in size So total number of quadwords is 1024

Screen layout Standard text screen: 25 rows, 80 columns Arrange 1K quadwords: 16 lines, 64 cells Enough room left for a title and a legend data title legend

Module’s design Build a ‘/proc’ module Can use a ‘wizard’ for Rapid Development’ Our ‘proc_read()’ function needs two parts 1) prepare the selected data-amalgation 2) draw screen display: title, data, legend

The ‘amalgamation’ step Use an array of byte-size elements: unsigned charglyph[ NR_CELLS ]; Define manifest constants: #define GRANULARITY 8 #define SZ sizeof( union task_union ) #define NR_CELLS (SZ/GRANULARITY)

Location of ‘task_union’ object We can use value of ‘current’ macro: char*cp = (char*)current; (This creates pointer to the object’s base)

An amalgamation algorithm inti, j; for ( i = 0; i < NR_CELLS; i++) { unsigned chartotal = 0; for (j = 0; j < GRANULARITY; j++) total |= cp[ i * GRANULARITY + j ]; glyph[ i ] = ( total ) ? ‘+’ : ‘-’; }

Algorithm rationale ‘clean’ memory will show up as ‘-’ ‘dirty’ memory will show up as ‘+’ But this won’t show areas we care about! We want to see the ‘process descriptor’ And we want to see the kernel stack

A ‘secondary’ algorithm Mark descriptor cells with letter ‘D’ And mark stack cells with letter ‘S’ But which are these cells in ‘glyth[]’ array?

Glyphs for descriptor and stack Process descriptor starts at offset zero Descriptor’s ‘size’ tell where it ends int d_top = sizeof( struct task_struct )/8; for (i = 0; i < NR_CELLS; i++) if ( i < d_top ) glyph[ i ] = ‘D’; Stack-area ends where task_union ends But where does stack-area start?

Reading cpu’s ESP register For IA-32 architectures, ESP = stacktop Need assembly language to read registers Here’s how to write it for gcc: Declare a memory-variable: unsigned longtos; Copy ESP register-value into variable ‘tos’: asm(“ movl %esp, %0 “ : “=m” (tos) );

‘kernel stack’ glyphs Task kernel-stack begins at address in ‘tos’ ints_org = ( tos / GRANULARITY ); for ( i = 0; i < NR_CELLS; i++) if ( i >= s_org ) glyph[ I ] = ‘S’;

Drawing the screen display Use ‘len’ variable to count output bytes Initialize ‘len’ to zero Draw to area whose address is in ‘buf’ Use ‘sprintf()’ function to draw into ‘buf’ Increment ‘len’ as more bytes are drawn: len += sprintf( buf+len, “\nMy Title\n” );

Use loop to draw data-glyphs Show 64 glyphs per line: for (i = 0; i < NR_CELLS; i++) { if ( ( i % 64 ) == 0 ) len += sprintf( buf+len, “\n” ); len += sprintf( buf+len, “%c”, glyph[ i ] ); }

Understanding and Esthetics Picture looks ‘upside down’ Shows descriptor higher than stack Also doesn’t show where data is located Can we draw it so that: it’s easier to understand? it displays more information? it is prettier to look at?

The visualization ‘demo’ Module ‘visual.c’ is on our course website Compile module using command $ make visual.o Install module using command $ /sbin/insmod visual.o Show ‘task_union’ object using command $ cat /proc/visual

Project #2 Write a Linux character device-driver Driver’s device-file will be: /dev/physmem Will allow programs to ‘read’ physical ram For safety: device should be ‘read-only’ Programs can treat ram as ordinary file

‘Physical’ versus ‘Virtual’ Linux maps physical memory to top 1-GB Physical memory starts from 0x Kernel ‘sees’ it as starting at 0xC Virtual address space 4GB Physical RAM High_memory