重大软院操作系统实验二:线程调度


重大软院操作系统实验二:线程调度,计算机操作系统原理,linux
资源截图
代码片段和文件信息
/*
 * vim: filetype=c:fenc=utf-8:ts=4:et:sw=4:sts=4
 */
#include “../global.h“
#include “syscall.h“
#include “math.h“
#include “graphics.h“


///////////////////辅助函数///////////////////////
#include “../tlsf/tlsf.h“
extern char end[];
void *malloc(size_t bytes)
{ return malloc_ex(bytes end); }
void *realloc(void *oldptr size_t bytes)
{ return realloc_ex(oldptr bytes end); }
void free(void *ptr)
{ free_ex(ptr end); }

#include 
int snprintf (char *str size_t count const char *fmt ...);
int vsnprintf (char *str size_t count const char *fmt va_list arg);
int printf(const char *fmt...)
{
    char buf[1024];
    va_list args;
    int i j;

    va_start(args fmt);
    i=vsnprintf(bufsizeof(buf) fmt args);
    va_end(args);

    for(j = 0; j < i; j++)
        putchar(buf[j]);

    return i;
}

/**
 * GCC insists on __main
 *    http://gcc.gnu.org/onlinedocs/gccint/Collect2.html
 */
void __main()
{
    init_memory_pool(64*1024*1024 end);
}

#define DELAY(n) do { 
    unsigned __n=(n); 
    while(__n--); 
} while(0);
///////////////////辅助函数///////////////////////
# define arrayNumber 10



void insertSort(int array[]int n)
{
if(array==NULL || n<=0)
return;
int ij;
int temp;
int count = 1;
    for(i=1;i    {
        if(array[i]        {
            temp=array[i];
            for(j=i-1;j>=0 && array[j]>temp;j--)
            {
                array[j+1]=array[j];
            }
            array[j+1]=temp;
        }

printf(“The %dth sorting“count);
COLORREF cr = RGB(23818137);
int ystart = 0;
int xstart = 4;
int xposition = 0;
int k1k2;
for(k1=0;k1 {
if(k1==0)
ystart = 70 * count;
else
ystart = ystart + 5;
xposition = xstart;
for(k2=1;k2<=array[k1]*5;k2++)
{
setPixel(4+k2ystartcr);
}
}
count++;
    }
}



void bubbleSort(int *array int n)
{
if(array == NULL || n<=0)
return;
    int i j temp;
int count = 1;
    for (j = 0; j < n - 1; j++)
{
 for (i = 0; i < n - 1 - j; i++)
        {
            if(array[i] > array[i + 1])
            {
                temp = array[i];
                array[i] = array[i + 1];
                array[i + 1] = temp;

            }
        }
printf(“The %dth sorting“count);
        COLORREF cr = RGB(00139);
        int ystart = 0;
        int xstart = 340;
        int xposition = 0;
        int k1k2;
        for(k1=0;k1                 {
                if(k1==0)
                ystart = 70 * count;
            else
            ystart = ystart + 5;
                xposition = xstart;
                for(k2=1;k2<=array[k1]*5;k2++)
                    {
                    setPixel(xposition+k2ystartcr);
                    }
                }
            count++;
}
       
}


void selectSort(int *ar

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-12-15 21:17  操作系统实验二
     目录           0  2015-12-15 14:39  操作系统实验二一
     文件        6313  2015-12-14 13:29  操作系统实验二一2.1main.c
     文件      102523  2015-12-14 13:45  操作系统实验二一操作系统实验二.docx
     目录           0  2015-12-15 21:38  操作系统实验二三
     目录           0  2015-12-15 21:18  操作系统实验二三epos
     目录           0  2015-12-15 21:18  操作系统实验二三epos.svn
     文件           3  2015-12-10 20:51  操作系统实验二三epos.svnentries
     文件           3  2015-12-10 20:51  操作系统实验二三epos.svnformat
     目录           0  2015-12-15 21:18  操作系统实验二三epos.svnpristine
     目录           0  2015-12-15 21:18  操作系统实验二三epos.svnpristine1
     文件       14952  2015-12-10 20:51  操作系统实验二三epos.svnpristine1133bbeec07642e1ed0e38e0a078ee3a3d98fd57.svn-base
     目录           0  2015-12-15 21:18  操作系统实验二三epos.svnpristine2
     文件        8291  2015-12-10 20:51  操作系统实验二三epos.svnpristine22b0b9520f366c7c15371b07d890ebb5d0e21630.svn-base
     目录           0  2015-12-15 21:18  操作系统实验二三epos.svnpristine17
     文件        1681  2015-12-10 20:51  操作系统实验二三epos.svnpristine1717f230794300383a59af8bae05af6784b4c574db.svn-base
     目录           0  2015-12-15 21:18  操作系统实验二三epos.svnpristine25
     文件        9978  2015-12-10 20:51  操作系统实验二三epos.svnpristine2525472e8d3d2d167b88052ef819efadb3f8e5f80b.svn-base
     目录           0  2015-12-15 21:18  操作系统实验二三epos.svnpristine2a
     文件        1440  2015-12-10 20:51  操作系统实验二三epos.svnpristine2a2a6d7a3d08da647a64cbfba8395d554f9bcba8e2.svn-base
     目录           0  2015-12-15 21:18  操作系统实验二三epos.svnpristine2b
     文件       19393  2015-12-10 20:51  操作系统实验二三epos.svnpristine2b2b73b7375502d4e255039c92d0bd3c88bc49a40c.svn-base
     目录           0  2015-12-15 21:18  操作系统实验二三epos.svnpristine33
     文件        1623  2015-12-10 20:51  操作系统实验二三epos.svnpristine3333584bc8892e89b501e8074affdc42b96d99bda8.svn-base
     目录           0  2015-12-15 21:18  操作系统实验二三epos.svnpristine42
     文件        1466  2015-12-10 20:51  操作系统实验二三epos.svnpristine4242909b6fd8431fbb602ee250f2de562717e97b06.svn-base
     目录           0  2015-12-15 21:18  操作系统实验二三epos.svnpristine43
     文件         181  2015-12-10 20:51  操作系统实验二三epos.svnpristine43432d8e098dda89b4b9caa96a8d2ccf7d30f58bcc.svn-base
     目录           0  2015-12-15 21:18  操作系统实验二三epos.svnpristine5c
     文件        7265  2015-12-10 20:51  操作系统实验二三epos.svnpristine5c5c3a40940b6cdc9bc91eecadec883c53b3a5c729.svn-base
     目录           0  2015-12-15 21:18  操作系统实验二三epos.svnpristine5f
............此处省略272个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)